-
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
Editor: Save post after deletion so that its status is refreshed and redirection happens. #17427
Conversation
…redirection happens.
yield dispatch( | ||
STORE_KEY, | ||
'resetPost', | ||
{ ...post, status: 'trash' } | ||
'savePost' |
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.
What does it mean to save a deleted post? My first impression is that we're abusing action creators a little in order to get a result not intended from them.
My second note is that the outbound comment mentions that editPost
isn't used because of its ties to change detection, while savePost
itself dispatches editPost
.
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.
What does it mean to save a deleted post? My first impression is that we're abusing action creators a little in order to get a result not intended from them.
It saves and refetches the post, getting the new status.
My second note is that the outbound comment mentions that editPost isn't used because of its ties to change detection, while savePost itself dispatches editPost.
I can't think of any issues it could cause.
In my testing, "Move to Trash" still doesn't complete a redirect, at least not without first prompting the user there are unsaved changes. #18269 is partly related here, though it applies to non-metabox scenarios. I worry also that we try to save all changes, when it's the case that the REST API may reject some of those pending changes (evidenced by the error message in #18269 about editing trashed posts). When I run |
It was a nasty race condition. Fixed and explained here: #18275.
That's expected, |
Fixes #17426
Description
This PR fixes the issue described in #17426.
How has this been tested?
It was verified that moving a post to the trash works as expected.
Types of Changes
Bug Fix: Redirect users after moving a post to the trash.
Checklist: