| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. Co-authored-by: hbhalodia <hbhalodia@git.wordpress.org> To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
What?
Closes #693
Why?
How?
Use of AI Tools
Testing Instructions
Screenshots or screencast
Screen.Recording.2026-06-10.at.1.23.34.PM.movChangelog Entry
AI Summary
Root cause
The Title Generation experiment attaches its "Generate"/"Regenerate" toolbar in normal editing mode via DOM injection in TitleToolbarWrapper.tsx (a registerPlugin render that manipulates the editor DOM directly, rather than rendering React into the editor tree).
Two pieces of logic made the attachment a one-time, irreversible operation:
When the user toggles Show template on, the editor swaps the post title region — the normal-mode .editor-post-title__input is replaced by the core/post-title block view. Toggling it back off recreates a fresh .editor-post-title__input, and React discards the old subtree, taking our injected .ai-title-toolbar-wrapper with it.
At that point the toolbar is gone from the DOM, but:
so nothing re-injects the toolbar onto the new title input. The component never unmounts during the toggle, so the effect's cleanup/re-run path never fires either. Only a full editor reload re-runs the useEffect and re-attaches — which is why a refresh "fixes" it.
What we fixed
In src/experiments/title-generation/components/TitleToolbarWrapper.tsx:
The re-attach is safe from infinite loops: inserting the wrapper triggers the observer again, but on that fire both isAttached and wrapperExists are true, so neither the reset nor the attach branch runs. The existing retry logic in findAndAttachToolbar() handles the brief window where the new title input hasn't rendered yet.
Result: toggling "Show template" off (or any editor interaction that recreates the title input) now re-injects the toolbar immediately, without requiring a page refresh.