Fix/bugbot 2.1.0#31
Merged
Merged
Conversation
Refactors heading level synchronization using `useLayoutEffect` and direct calls. This prevents visual delays and inconsistencies when the parent FAQ block's `isAccordion` or `headingLevel` attributes change in the editor.
Ensures that new FAQ questions are merged with existing ones in the schema data, rather than overwriting them. Normalizes the structure of existing questions and renumbers all combined questions to maintain valid Schema.org position values.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2f1d1f8. Configure here.
Updates the `useSyncQuestionHeadingLevels` hook to leverage `@wordpress/data`'s `useSelect` and `useDispatch` for accessing block editor state and actions. This removes the need to pass the `blockEditor` object as a prop, improving the hook's encapsulation and aligning with modern WordPress block editor development patterns.
Updates the `useSyncQuestionHeadingLevels` hook to explicitly select the inner FAQ question blocks using `useSelect`. By including these blocks in the `useEffect` dependencies, heading levels are now correctly re-synchronized when questions are added, removed, or reordered within the FAQ block.
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.

Note
Low Risk
Editor UX and structured-data merging only; no auth or sensitive data paths, with a small risk of duplicate FAQ entries if SEOpress and blocks both define overlapping questions.
Overview
SEOpress FAQ schema now appends block-generated questions to any existing
mainEntityfrom SEOpress instead of replacing them. New helpers normalizemainEntity(single question vs list) and assign sequentialpositionvalues on the merged list.FAQ block editor refactors question heading level sync: shared
syncQuestionHeadingLevels,useLayoutEffectfor ongoing sync, and immediate sync when accordion is turned on or the heading level control changes (not only via a passive effect). Block editor store usage is aligned viablockEditorStoreand explicitclientId.Reviewed by Cursor Bugbot for commit 9bdccb9. Bugbot is set up for automated code reviews on this repo. Configure here.