Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#56778 closed defect (bug) (fixed)

Block usage isn't being persisted for usage in WordPress 6.1

Reported by: talldanwp's profile talldanwp Owned by: audrasjb's profile audrasjb
Milestone: 6.1 Priority: normal
Severity: normal Version: 6.1
Component: Editor Keywords: has-patch commit
Focuses: Cc:

Description (last modified by talldanwp)

Reporting a bug that I caused accidentally in the backport for the new persisted preferences (https://github.com/WordPress/wordpress-develop/pull/3253).

In the PR, the configuration for the old preference persistence system was removed - https://github.com/WordPress/wordpress-develop/pull/3253

It turns out this was a little too eager. This system is still used for block usage data (to show the most frequently used blocks in the inserter). Furthermore some plugins may use this persistence system (though I found none on WPDirectory).

The fix is to add this code back in and I have a PR ready to do that. For 6.2 I'll work on removing any core usage of it and deprecating it.

Steps to reproduce:
Prerequisite: Remove the WORDPRESS_DATA_USER_{n} local storage data.

  1. Open up a block editor and insert the same block a few times (e.g. Code block).
  2. Trigger the / inserter an notice Code is now top of the list.
  3. Reload the block editor.
  4. Trigger the / inserter again and noticed Code block is no longer top of the list.

Expected: Code should be persisted across sessions as the most used block.

Change History (5)

#1 @talldanwp
2 years ago

  • Description modified (diff)

This ticket was mentioned in PR #3423 on WordPress/wordpress-develop by talldan.


2 years ago
#2

In https://github.com/WordPress/wordpress-develop/pull/3253 I was a little too eager to remove the old preferences persistence configuration. This system is still used in the block editor for block inserter usage, so removing this accidentally caused the 'most used blocks' feature to stop working.

Trac ticket: https://core.trac.wordpress.org/ticket/56778
---

Steps to reproduce:
Prerequisite: Remove the WORDPRESS_DATA_USER_{n} local storage data (where {n} is your used id).

  1. Open up a block editor and insert the same block a few times (e.g. Code block).
  2. Trigger the / inserter an notice Code is now top of the list.
  3. Reload the block editor.
  4. Trigger the / inserter again and noticed Code block is no longer top of the list.

In trunk: The code block is no longer present at the top of the list.
In this branch: The code block should be persisted across sessions as the most used block.

#3 @audrasjb
2 years ago

  • Keywords commit added
  • Owner changed from talldanwp to audrasjb
  • Status changed from assigned to accepted

I can confirm the PR fixes the issue on my side: "Most used blocks" works fine in the inserter.

Self assigning for commit.

#4 @audrasjb
2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 54485:

Editor: Reinstate old persistence system configuration for the block editor usage data.

In [54182], the configuration for the old preference persistence system was removed. This system is still used for block usage data (to show the most frequently used blocks in the inserter). Furthermore some plugins may use this persistence system.

This changeset reinstates the previous persistence system used by the "Most used blocks" feature in the block inserter.

Follow-up to [54182].

Props talldanwp.
Fixes #56778.

Note: See TracTickets for help on using tickets.