fix(editor): Ensure reliable unregistration of block variations#498
Closed
firestar300 wants to merge 2 commits into
Closed
fix(editor): Ensure reliable unregistration of block variations#498firestar300 wants to merge 2 commits into
firestar300 wants to merge 2 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
domReadyfires.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/datasubscribe+getBlockType) before callingunregisterBlockVariation.Refactors editor-side unregistration into helper functions, makes disabled styles handling accept single or array values, and renames the injected settings global from
BFFEditorSettingstoBEAPI_EDITOR_SETTINGS(updated in both PHP inline script andsrc/js/editor.js).Reviewed by Cursor Bugbot for commit 1442a33. Bugbot is set up for automated code reviews on this repo. Configure here.