Skip to content

fix(editor): Ensure reliable unregistration of block variations#498

Closed
firestar300 wants to merge 2 commits into
masterfrom
fix/editor-script
Closed

fix(editor): Ensure reliable unregistration of block variations#498
firestar300 wants to merge 2 commits into
masterfrom
fix/editor-script

Conversation

@firestar300
Copy link
Copy Markdown
Contributor

@firestar300 firestar300 commented May 18, 2026

Introduces a mechanism to wait for target blocks to be fully registered in the editor store before attempting to unregister their variations. This prevents potential issues where variations might not be unregistered if blocks are not yet available when domReady fires.

Additionally, this change refactors block style and variation unregistration into dedicated helper functions for improved code organization and readability.


Note

Medium Risk
Changes Gutenberg editor initialization timing and settings global name, which could impact block style/variation availability in the editor if misconfigured.

Overview
Improves reliability of Gutenberg variation unregistration by waiting until target blocks are registered (via @wordpress/data subscribe + getBlockType) before calling unregisterBlockVariation.

Refactors editor-side unregistration into helper functions, makes disabled styles handling accept single or array values, and renames the injected settings global from BFFEditorSettings to BEAPI_EDITOR_SETTINGS (updated in both PHP inline script and src/js/editor.js).

Reviewed by Cursor Bugbot for commit 1442a33. Bugbot is set up for automated code reviews on this repo. Configure here.

Introduces a mechanism to wait for target blocks to be fully registered in the editor store before attempting to unregister their variations. This prevents potential issues where variations might not be unregistered if blocks are not yet available when `domReady` fires.

Additionally, this change refactors block style and variation unregistration into dedicated helper functions for improved code organization and readability.
@firestar300 firestar300 deleted the fix/editor-script branch May 18, 2026 18:56
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.

1 participant