-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Dirty state is still cleared if post is edited while prolonged save request is made #6112
Comments
Discussed in Slack: https://wordpress.slack.com/archives/C02QB2JS7/p1523341790000232 |
Actually, I think it's more to do with iterations that have occurred over time in dirty detection: #1996, #3298 The approach in #1996 worked because The |
Aside: This is a good candidate for E2E testing, since it's very technically challenging and easy to overlook in general usage, and also easy to reproduce in an automated environment. |
Issue Overview
If you make a change to a post, then press update and the update request is slow to respond (either due to connectivity or server issues), and make another change while
isPostSaving
then when the response finishes the dirty state is erroneously cleared and I am unable to save the new changes I made the save request was pending.Steps to Reproduce
Tested using
master
at ab7a429.sleep(5)
to the top of\WP_REST_Posts_Controller::update_item()
.Expected Behavior
The Save Draft button should be re-shown to the user after the save request completes when a change was made during the request. Additionally, there should be the “Are you sure?” dialog when leaving the page at this point so that the user does not lose their changes.
Possible Solution
Introduce a new state flag for
isEditedWhileSaving
and if when the response completes, check this before resettingisDirty
tofalse
.Screenshots / Video
Screencast of issue: https://youtu.be/HLF7VTd8gjY
The text was updated successfully, but these errors were encountered: