feat(bulk-editor): add pending-changes guard seam for external plugins#23405
Draft
thijsoo wants to merge 2 commits into
Draft
feat(bulk-editor): add pending-changes guard seam for external plugins#23405thijsoo wants to merge 2 commits into
thijsoo wants to merge 2 commits into
Conversation
Lets an external plugin (Premium AI suggestions) report pending changes via a new externalPendingChanges store flag, so the tab-change guard defers the switch and renders a PENDING_CHANGES_MODAL_SLOT for the plugin to fill with its own confirmation modal. A self-healing effect completes a deferred switch once its guard clears, so pendingTab can't get stranded. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Coverage Report for CI Build 0Coverage decreased (-5.6%) to 45.605%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
|
A merge conflict has been detected for the proposed code changes in this PR. Please resolve the conflict by either rebasing the PR or merging in changes from the base branch. |
…into 1297-premium-fe-5-bulk-editor-ai-suggested-pending-changes-alert # Conflicts: # packages/js/src/bulk-editor/components/bulk-editor-content.js # packages/js/src/bulk-editor/constants.js
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.
Context
The bulk editor already guards a tab switch (Search ↔ Social) when there are unsaved manual inline edits, via
UnsavedChangesModal. Premium needs the same guard for unapplied AI suggestions, but the tab-switch logic lives entirely in Free and has no knowledge of an add-on's state. This PR adds a small, reactive seam so an add-on can defer a tab switch and supply its own confirmation modal.Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
externalPendingChangesstore boolean with asetHasExternalPendingChangesaction andselectHasExternalPendingChangesselector, registered on the@yoast/bulk-editorstore.onChangeTabnow defers the switch when the flag is set (manual edits keep precedence); a newPENDING_CHANGES_MODAL_SLOT(yoast.bulkEditor.pendingChangesModal) is rendered with fillProps{ isOpen, onCommit, onCancel }for the add-on to fill.pendingTabcan never be stranded with no modal to resolve it.Test instructions
Test instructions for the acceptance test before the PR gets merged
This is a non-user-facing seam; on its own (Free only) it must not change existing behaviour. The user-visible behaviour is tested via the Premium PR.
Relevant test scenarios
Test instructions for QA when the code is in the RC
Not applicable — non-user-facing seam; the user-visible behaviour is verified through the Yoast SEO Premium PR.
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
@yoast/bulk-editordata store.Other environments
Documentation
Quality assurance
grunt build:imagesand committed the results, if my PR introduces or edits images or SVGs.Innovation
Part of Yoast/reserved-tasks#1297.