Skip to content

Editor: Register the write blocker before disable-features runs - #81

Merged
obenland merged 1 commit into
trunkfrom
fix/block-preference-write-on-load
Oct 23, 2026
Merged

obenland merged 1 commit into
trunkfrom
fix/block-preference-write-on-load

Conversation

@obenland

Copy link
Copy Markdown
Member

Found during final checks on trunk after #71–#80.

Problem

Every front-page load sends a real PUT /wp/v2/users/me, the preferences save that the write blocker in js/editor-modifications.js is supposed to stop:

  • Logged out: core answers 404 (rest_user_invalid_id, user 0). It's harmless, but it's a server request on every visit.
  • Logged in: it returns 200 and writes wp_persisted_preferences user meta for that visitor on the Frontenberg site.

The cause: #77 sets the isComplementaryAreaVisible preference at the top level of plugins/disable-features/index.js. The preferences persistence layer debounces its saves, but its debounce fires on the leading edge, so the first save goes out immediately. disable-features was enqueued before editor-modifications, so that first PUT ran before the write blocker was registered. Later saves are blocked, because the blocker is in place by then.

Fix

Add editor-modifications as a dependency of plugin-disable-features-js, so the write blocker is always registered before disable-features runs.

Testing

Chrome, local wp-env on WP 7.2-beta1:

trunk this PR
Logged out: users/me requests on load 1 (404) 0
Logged in: users/me requests on load 1 (200) 0
Logged in: wp_persisted_preferences meta after load written not written
Sidebar closed on load (#52) yes yes
Preference kept in localStorage yes yes

Production note

Since #77 was deployed, logged-in wordpress.org users who visited /gutenberg/ may have wp_persisted_preferences meta on that site. It only holds editor UI preferences, such as the sidebar being closed and the welcome guide being dismissed. If you want to clean it up, it can be deleted.

🤖 Generated with Claude Code

#77 sets the isComplementaryAreaVisible preference when disable-features loads.
The preferences persistence layer sends its first save immediately (its debounce
fires on the leading edge), and disable-features loaded before
editor-modifications.js, so that PUT /wp/v2/users/me went out before the write
blocker was registered: a 404 for every logged-out visit, and a real write of
persisted_preferences user meta for logged-in visitors.

Make disable-features depend on editor-modifications so the blocker is in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings October 23, 2026 20:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@obenland
obenland merged commit 8b6d7f1 into trunk Oct 23, 2026
@obenland
obenland deleted the fix/block-preference-write-on-load branch October 23, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants