Conversation
|
Size Change: +46 B (0%) Total Size: 7.66 MB
ℹ️ View Unchanged
|
tellthemachines
left a comment
There was a problem hiding this comment.
This is working well, thanks for fixing!
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
a6b19d6 to
1558d34
Compare
|
LGTM Nice catch! Kapture.2026-03-20.at.14.45.09.mp4 |
|
Flaky tests detected in 1558d34. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/23327932499
|
…ting 'Edit pattern' (#76710) Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
|
I just cherry-picked this PR to the wp/7.0 branch to get it included in the next release: 9ed51d1 |
| // check whether the edited section still exists in the new block tree. | ||
| if ( ! getFlattenedClientIds( action.blocks )[ state ] ) { | ||
| return undefined; | ||
| } |
There was a problem hiding this comment.
Is it possible that the editedContentOnlySection is not in the top-level tree, but in a nested one? For example, in a template-locked mode the top-level tree is the post template, then there is a nested controlled entity, like post content or template part, and only in that nested entity is something nested even further, e.g., a pattern?
In such a case the RESET_BLOCKS' action.block won't contain the nested block ID. and the flag will be incorrectly cleared.
RESET_BLOCKS doesn't happen only on navigation, but also when the edited entity has changes coming from external source, like from RTC server. Then useBlockSync will call RESET_BLOCKS with updated blocks coming from the edited entity.
The blockEditingModes state has similar problems--what to reset and when?--and I'm trying to figure it out in #76529. That's why this PR caught my attention.
There was a problem hiding this comment.
I think that is a possibility. The replace/remove blocks cases could also be more robust and I was planning a follow-up for that.
My idea is to lift the withInnerBlocksRemoveCascade higher order reducer up so that other reducers can also access the REPLACE_BLOCKS_AUGMENTED_WITH_CHILDREN and REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN actions. There are a few reducers across the block editor store that I think probably don't clean up clientId state properly and could benefit.
Perhaps something similar is possible with RESET_BLOCKS.
This updates the pinned hash from the `gutenberg` from `487a096a9782ba6110a7686d7b4b2d0c55ed1b06` to `2ee7ede6be6d4e55d5c7047394c5c4e0ea8d521d`. The following changes are included: - RTC: Backport race condition fix (WordPress/gutenberg#76649) - Fix navigation block rendering unit test (WordPress/gutenberg#76685) - Hide Additional CSS controls when block is inside contentOnly editing mode (WordPress/gutenberg#76512) - RTC: Increase polling intervals, increase polling on primary room only (WordPress/gutenberg#76704) - Navigation: Avoid List View changing position when navigation block saves (WordPress/gutenberg#76659) - Fix navigation block unit test and e2e test (WordPress/gutenberg#76692) - Fix locked content when switching to a different template without exiting 'Edit pattern' (WordPress/gutenberg#76710) - Metabox: Fix checkbox style in sidebar (WordPress/gutenberg#76718) - Stop keeping stale controlled blocks after reset (WordPress/gutenberg#76591) - Gate client-side media processing as plugin-only (WordPress/gutenberg#76700) A full list of changes can be found on GitHub: https://github.com/WordPress/gutenberg/compare/487a096a9782ba6110a7686d7b4b2d0c55ed1b06…2ee7ede6be6d4e55d5c7047394c5c4e0ea8d521d. Log created with: git log --reverse --format="- %s" 487a096a9782ba6110a7686d7b4b2d0c55ed1b06..2ee7ede6be6d4e55d5c7047394c5c4e0ea8d521d | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy See #64595. git-svn-id: https://develop.svn.wordpress.org/trunk@62076 602fd350-edb4-49c9-b593-d223f7449a82
This updates the pinned hash from the `gutenberg` from `487a096a9782ba6110a7686d7b4b2d0c55ed1b06` to `2ee7ede6be6d4e55d5c7047394c5c4e0ea8d521d`. The following changes are included: - RTC: Backport race condition fix (WordPress/gutenberg#76649) - Fix navigation block rendering unit test (WordPress/gutenberg#76685) - Hide Additional CSS controls when block is inside contentOnly editing mode (WordPress/gutenberg#76512) - RTC: Increase polling intervals, increase polling on primary room only (WordPress/gutenberg#76704) - Navigation: Avoid List View changing position when navigation block saves (WordPress/gutenberg#76659) - Fix navigation block unit test and e2e test (WordPress/gutenberg#76692) - Fix locked content when switching to a different template without exiting 'Edit pattern' (WordPress/gutenberg#76710) - Metabox: Fix checkbox style in sidebar (WordPress/gutenberg#76718) - Stop keeping stale controlled blocks after reset (WordPress/gutenberg#76591) - Gate client-side media processing as plugin-only (WordPress/gutenberg#76700) A full list of changes can be found on GitHub: https://github.com/WordPress/gutenberg/compare/487a096a9782ba6110a7686d7b4b2d0c55ed1b06…2ee7ede6be6d4e55d5c7047394c5c4e0ea8d521d. Log created with: git log --reverse --format="- %s" 487a096a9782ba6110a7686d7b4b2d0c55ed1b06..2ee7ede6be6d4e55d5c7047394c5c4e0ea8d521d | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy See #64595. Built from https://develop.svn.wordpress.org/trunk@62076 git-svn-id: http://core.svn.wordpress.org/trunk@61358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
What?
Props to @tellthemachines for catching this issue.
When editing a pattern in one template and then switching to another template without exiting the edited pattern, the entire content of the second template can appear locked.
Why?
It happens because
editedContentOnlySectioncan contain a staleclientIdwhen the entire content is reset. When switching to a different template theclientIdstored no longer exists, but other code still interprets it as a valideditedContentOnlySectionin the state.How?
Handle actions like removing, replacing or resetting blocks and ensure the
editedContentOnlySectionis cleared as necessary.Testing Instructions
In trunk: The entire template content is locked/inert
In this PR: The content is editable as normal
Screenshots or screencast
Before
Kapture.2026-03-20.at.10.58.30.mp4
After
Kapture.2026-03-20.at.10.55.31.mp4
Use of AI Tools
OpenCode / Claude