-
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 regression for root appender logic #68994
Conversation
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. |
const hasSelectedRoot = !! ( | ||
rootClientId && | ||
selectedBlockClientId && | ||
rootClientId === 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.
The previous code relied on returned type semantics; this ensures that client IDs are checked for equality.
Size Change: +11 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
Flaky tests detected in df72157. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/13090066335
|
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 quick fix!
This may not be something we need to fix in this PR, but I noticed that the inserter button doesn't appear when the "Show Template" is enabled. Maybe there's some logic we need to add.
- Hide the Paragraph block
- Open any post
- Disable "Show Template"
- ✅The inserter appears
- Enable "Show Template"
- 🤔 The inserter doesn't appear
9cdee087df71c6f9eefffeff7c66c660.mp4
Thanks for testing, @t-hamano! That's interesting, and I'll investigate separately. On the surface, it seems like a desired behavior. The Post Content becomes our root block; appender logic becomes similar to Group or any other container block. It's displayed when the root block is selected. |
Co-authored-by: Mamaduka <[email protected]> Co-authored-by: t-hamano <[email protected]>
What?
A follow-up to #68951.
PR fixes a regression when the root appender is incorrectly displayed.
After switching a method for retrieving
selectedBlockClientId
, arootClientId === selectedBlockClientId
condition became true when no blocks were selected. Why?The
getSelectedBlockClientId
select returnsnull
with no block selection, androotClientId
isundefined
, failing equality checks. NowselectedBlockClientId
also returnsundefined
, which introduces a regression.I've hardened the check to ensure equality is checked only for
clientId
strings.Testing Instructions
Testing Instructions for Keyboard
Same.
Screenshots or screencast