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
Editor store: remove a noop SETUP_EDITOR action #38622
Conversation
Size Change: -11 B (0%) Total Size: 1.14 MB
ℹ️ View Unchanged
|
f65efc6
to
19498fb
Compare
Added removal/deprecation of one more action: |
type: 'RESET_POST', | ||
post, | ||
}; | ||
export function resetPost() { |
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.
This feels like an action that could potentially be used by third party plugins, it would be good to try to find usage in wpdirectory.net before making this breaking change.
Alternatively, we can also consider deprecating it but keeping its behavior.
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 searched in wpdirectory.net and haven't found any usage of resetPost
.
Even if it was used, what would it be supposed to do? The action used to reset the entire post with all attributes (content, title, ...) to a new value, but today it can change just the ID and type. Everything else has moved to the core store. And can resetPost
be really used to completely reinitialize the editor with an entirely new post ID? I doubt that it's so easy and that setting "current post ID" in editor state is enough.
I can modify the patch to keep the RESET_POST
reducer behavior -- my main goal is to remove the redundant resetPost
call from setupEditor
.
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 looking, let's keep it that way and adapt if we ever receive any feedback about this.
In the
dispatch( editorStore ).setupEditor
action, this PR removes the dispatch of theSETUP_EDITOR
effect/action. There is no effect registered or a reducer reacting to this action type, so it's a noop. There is only aSETUP_EDITOR_STATE
action that is active.Stumbled upon this when working on #35929, migrating the
editor
store to thunks.