-
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
Metaboxes save: perform hasMetaBoxes check on every save #45145
Conversation
Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
Size Change: +119 B (0%) Total Size: 1.28 MB
ℹ️ View Unchanged
|
const shouldTriggerMetaboxesSave = | ||
hasMetaBoxes && |
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 we keep the call to select.hasMetaBoxes()
here that way a single boolean is enough for the check later?
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.
Like the change in 5c4e4c7? Done!
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.
Thank you, @jsnajdr!
Tested with demo plugin, and it works as expected.
Fixes #44716 by kind of reverting the optimization in #15041. The assumption about metaboxes being initialized only on rendering was wrong: folks add new metaboxes dynamically.
The patched code is still optimized because we call
select.hasMetaBoxes()
only after detecting there is a "save finished" event, which is quite rate, the selector is not called on every registry state update like it was before #15041.