Reset blockEditingModes on RESET_BLOCKS#76529
Conversation
|
Size Change: +7 B (0%) Total Size: 7.66 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in e0cd6a2. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/23436273815
|
|
Could this aggravate issues like #76025?
Just wanted to flag this as something to keep in mind. |
|
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. |
Thanks for flagging, I believe all these issues are strongly connected together. More here: #76025 (comment) |
|
Thanks for replying there! |
|
Reading this comment I'm a bit confused if this is the right fix and if it's even needed. Can you please elaborate/follow up on what the suggested next path is for resolving #76310? |
I'd like to hear @talldan's feedback about this. In current Still even after #76305 the whole approach is very fragile. The At this moment it seems that the 7.0 branch is fixed and there is no immediate danger. |
ad8aecc to
e0cd6a2
Compare
|
@tyxla @talldan I updated this PR so that it preserves the The first (biggest) commit moves The second and third commit add a unit test and the actual fix. |
Mamaduka
left a comment
There was a problem hiding this comment.
Thanks, @jsnajdr!
Changes here make sense and align with other recent optimizations. It would be nice to have e2e tests for this regression, but it's not a straightforward scenario, so improved unit tests will suffice.
I've noticed a minor change in typing performance, though they're expected margins. I've restarted perf tests just to be sure.
* Move the blockEditingModes state to state.blocks * Add unit test for blockEditingModes preservation * Preserve valid blockEditingModes on reset Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org>
|
I just cherry-picked this PR to the wp/7.0 branch to get it included in the next release: 05cad06 |
|
Nice to see this one resolved, thank you! |
* Move the blockEditingModes state to state.blocks * Add unit test for blockEditingModes preservation * Preserve valid blockEditingModes on reset Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org>
This updates the pinned hash from the `gutenberg` from `3edafcc90fc4520939d69279e26ace69390582be` to `0d133bf7e7437d65d68a06551f3d613a7d8e4361`. The following changes are included: - Reset blockEditingModes on RESET_BLOCKS (WordPress/gutenberg#76529) - RTC: Remove stale wp_enable_real_time_collaboration option check (WordPress/gutenberg#76810) - RTC: Fix editor freeze when replacing code editor content (WordPress/gutenberg#76815) - Preferences: Hide collaboration options when RTC is not enabled (WordPress/gutenberg#76819) - Editor: Fix template revisions using 'modified' date field instead of 'date' (WordPress/gutenberg#76760) - `ControlWithError`: Connect validation messages to controls via `aria… (WordPress/gutenberg#76835) A full list of changes can be found on GitHub: https://github.com/WordPress/gutenberg/compare/3edafcc90fc4520939d69279e26ace69390582be…0d133bf7e7437d65d68a06551f3d613a7d8e4361. Log created with: git log --reverse --format="- %s" 3edafcc90fc4520939d69279e26ace69390582be..0d133bf7e7437d65d68a06551f3d613a7d8e4361 | 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@62150 602fd350-edb4-49c9-b593-d223f7449a82
This updates the pinned hash from the `gutenberg` from `3edafcc90fc4520939d69279e26ace69390582be` to `0d133bf7e7437d65d68a06551f3d613a7d8e4361`. The following changes are included: - Reset blockEditingModes on RESET_BLOCKS (WordPress/gutenberg#76529) - RTC: Remove stale wp_enable_real_time_collaboration option check (WordPress/gutenberg#76810) - RTC: Fix editor freeze when replacing code editor content (WordPress/gutenberg#76815) - Preferences: Hide collaboration options when RTC is not enabled (WordPress/gutenberg#76819) - Editor: Fix template revisions using 'modified' date field instead of 'date' (WordPress/gutenberg#76760) - `ControlWithError`: Connect validation messages to controls via `aria… (WordPress/gutenberg#76835) A full list of changes can be found on GitHub: https://github.com/WordPress/gutenberg/compare/3edafcc90fc4520939d69279e26ace69390582be…0d133bf7e7437d65d68a06551f3d613a7d8e4361. Log created with: git log --reverse --format="- %s" 3edafcc90fc4520939d69279e26ace69390582be..0d133bf7e7437d65d68a06551f3d613a7d8e4361 | 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@62150 git-svn-id: http://core.svn.wordpress.org/trunk@61432 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Move the blockEditingModes state to state.blocks * Add unit test for blockEditingModes preservation * Preserve valid blockEditingModes on reset Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org>
This fixes a part of #76310. Where a newly created page has read-only content and can't be modified. How to reproduce:
RESET_BLOCKS, a big part of the block tree will stay the same, and only some of the controlled inner blocks will change. The logic in Block Editor: Optimize controlled inner blocks state churn #75458 will try to preserve the inner blocks.This happens because:
disabled, and then selectively setscontentOnlyto some of the child blocks (template parts,core/post-content). TheDisableNonPageContentBlockscomponent does this.RESET_BLOCKSwill preserve only thedisabledflag for the root block, but will remove all thecontentOnlyflags for the child blocks. They all become disabled.DisableNonPageContentBlockswill not reconstruct the block editing mode flags.I'm fixing this by:
blockEditingModesstate tostate.blocks.blockEditingModesso that theblocksreducer, wrapped withwithBlockReset, can modify the state onRESET_BLOCKS.RESET_BLOCKS, preserve the editing mode of blocks that still exist and have the same client ID. Including controlled inner blocks. Very similar to preservation ofcontrolledInnerBlocksin Stop keeping stale controlled blocks after reset #76591.This and #76591 together fixes all known causes of #76310, which can be closed after this PR is merged.