-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Block Editor: Deprecate block hovered global state #70731
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
Conversation
Size Change: -22 B (0%) Total Size: 1.89 MB
ℹ️ View Unchanged
|
Flaky tests detected in ee0e2f4. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/16294048074
|
packages/block-editor/src/components/block-list/use-block-props/use-is-hovered.js
Outdated
Show resolved
Hide resolved
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. |
export function getHoveredBlockClientId( state ) { | ||
return state.hoveredBlockClientId; | ||
} |
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.
I'm in two minds about removing the action/selectors completely. Not sure if an option might be to have it return undefined
and log a deprecation message. It at least prevents the editor from blowing up completely.
The action could do the same (not dispatch anything), though I'm not sure if an action returning undefined
is an issue - would it be ignored?
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.
I was also hesitant about removing these vs deprecation. But here's why I decided to do so:
- The
https://wpdirectory.net/
returns no results for them. - These actions/selectors shouldn't have been made public in the first case.
- The revert should've happened in Only show zoom out inserters on block selection #65759, but that ship has sailed :(
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.
@talldan, added changelog entry and marked this a breaking change.
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 https://wpdirectory.net/ returns no results for them.
I don't think this is completely exhaustive, which is why I'm hesitant about it. There's also plugins outside the repo and custom code added to individual sites that it doesn't cover.
I agree though, I can't imagine anyone using the APIs.
Alternative compromise could be to keep the functions with deprecations for a few releases, then follow up and remove them after a couple of plugin releases with the deprecation message active.
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.
Everything still works as before from a user perspective in my testing.
There was a discussion about whether to keep the selector/action functions and add a deprecation message. I'll let you make a call on it @Mamaduka.
Thanks, @talldan! I restored the action/selector and added deprecation warnings; there's no need to risk breakage. We should be more careful when introducing new public APIs in the future. |
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org>
What?
PR reverts block hovered global state from the block editor package, introduced in #63668.
Why?
Testing Instructions
is-hovered
style is correctly applied to the block wrapper. This can be checked via DevTools.Testing Instructions for Keyboard
Same.