Editor store: remove createUndoLevel and refreshPost actions#38585
Conversation
|
Size Change: -48 B (0%) Total Size: 1.14 MB
ℹ️ View Unchanged
|
youknowriad
left a comment
There was a problem hiding this comment.
Should we keep the functions with a deprecated call (and remove their content) instead for some versions to avoid creating JS errors for potential plugins using them even if they don't do anything?
0f95628 to
f6c3fd6
Compare
Yes I changed the patch to make the action creators empty (returning a One thing I'm not sure about is how to express the "deprecated since" versions. Since WordPress 5.9? Since Gutenberg 13.0.0? Both versioning lines seem to be used. |
|
I think it should be |
|
We use Gutenberg version only for things that didn't make it yet to WordPress. |
|
Pushed a commit that clarifies the versions: deprecated in 6.0, removed in 6.3. |
| return { type: 'CREATE_UNDO_LEVEL' }; | ||
| deprecated( "wp.data.dispatch( 'core/editor' ).createUndoLevel", { | ||
| since: '5.9', | ||
| alternative: 'Use the core entities store instead', |
There was a problem hiding this comment.
Is GitHub missing a commit or something, I don't see the "version": "6.0"
There was a problem hiding this comment.
Sorry, turns out I didn't really push the commit to the server 🙂 Please look again now.
This PR removes two
editorstore actions that are unused. Even if someone tried to use them, they would discover they don't do anything useful at all.createUndoLevelwas gradually moved to thecorestore (especially in #13088), and today theeditorreducer doesn't react to theCREATE_UNDO_LEVELaction at all.refreshPostused to be used in thePostPermalinkcomponent, but that one was removed in #21099. The action used to fetch the latest version of the post from REST API, and store it in state withresetPost. But today theresetPostaction resets just theidandtypefields, which are kind of guaranteed to never change.In short, gradual and mechanical refactorings removed all meaning from these two actions. Regarding backward compatibility, can we safely remove them? Given that the Gutenberg codebase doesn't use them, and anyone else doesn't have any reason to call them?
Discovered this when refreshing #35929, my PR to migrate the
editorstore to thunks.