-
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
EditorInitialization: Fix ESLint warnings for internal hooks #59118
EditorInitialization: Fix ESLint warnings for internal hooks #59118
Conversation
Size Change: -10 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
Flaky tests detected in 01a63a4. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7927097796
|
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.
Just to make sure I understand: previously, we were re-initializing the post editor when the post changes, and this will no longer be the case after this PR.
That sounds OK for the most part, but I wonder if we're missing a scenario when the post will change without a page reload and we'll need to properly reinitialize like we did before. That scenario could be a third-party plugin one, theoretically.
Otherwise, if we are certain that we don't need to reinitialize when the post ID changes, this is a cool cleanup and a nice find!
WDYT? Should we seek a second opinion?
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. |
The listener hooks don't need to react to post ID change, even if it happens without page reload due to some third-party integration. They should only react to value changes in store. Passing the unused |
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.
Can't think of a good reason to continue reinitializing the editor on the post ID change. Happy to trust your judgment on the potential breaking impact on third-party use.
This is a nice cleanup 👍
packages/edit-post/src/components/editor-initialization/test/listener-hooks.js
Show resolved
Hide resolved
01a63a4
to
8f47de9
Compare
What?
PR fixes ESLint warnings for the
EditorInitialization
component internal hooks. It mainly removes unnecessarypostId
dependency; the hooks don't use the value, and it won't change after the editor is initialized.Testing Instructions
DFM
Testing Instructions for Keyboard
Same.