You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
To aid with testing, add sleep(5) to the top of \WP_REST_Posts_Controller::update_item().
Open a post draft.
Make a change to a post.
Hit Save Draft
While the save request is happening make another change to the post.
Once the save request finishes, try to save the change you just made.
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 resetting isDirty to false.
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: