-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Block Editor: Fix Block editor crash #56051
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange how tests passed in that PR
Thank you for your quick review! |
Size Change: +3 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
@ellatrix The editor crashes on trunk, so it seems like the performance test just won't pass. Can we force merge? |
What's the problem? |
The two actions that are failing are showing the following errors:
I think this error is occurring in this test file. This test actually tries to insert the block, but the block editor is broken in trunk, so I'm expecting the test to always fail. |
Forced it |
Thankfully, all GitHub Action tests on trunk seem to have passed. |
blockEditingMode, | ||
hasParents, | ||
showParentSelector, | ||
selectedBlockClientId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this! It doesn't look like selectedBlockClientId
is used at all. Does it work to remove selectedBlockClientId
from line 48 instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reply. Isn't selectedBlockClientId
needed here?
gutenberg/packages/block-editor/src/components/block-tools/block-contextual-toolbar.js
Lines 92 to 94 in f137d97
// Resets the index whenever the active block changes so | |
// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169 | |
key={ selectedBlockClientId } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! I was still checked out on the add/top-toolbar-slot
branch #55787. In that branch it wasn't used and so the tests weren't failing. Once #56008 was also merged to trunk
, it became an issue and your fix is the right one. Sorry for the confusion, and thank you for the fix! I feel better now understanding why the bug happened.
Related to #55787
What?
This PR fixes a crash when clicking on the editor canvas.
d1eb3d42659d6355fd92e417ed6df6e9.mp4
Why?
The following is logged in the browser console:
It looks like the
selectedBlockClientId
obtained via useSelect is not defined correctly as a variable.How?
See diff
Testing Instructions
It should pass all tests correctly.