Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Saving: Autosaveable does not account for autosave existing at start of editing #7416
Describe the bug
If an autosave revision exists for a published post (or draft authored by another user), and non-content field edits exist,
Steps to reproduce the behavior:
There are no changes to the saved copy of the post to be previewed (title, content, excerpt), so the preview window should direct to the saved post link and not initiate a request to the autosaves endpoint.
The "Preview Loading" interstitial is wrongly displayed. A request is sent to the autosaves endpoint and responds with a 400 Bad Request code.
In the above flow, an autosave exists but it is not known to state. A solution may be to simply ensure that the autosave is populated at the start of the editor session, so it can continue to the condition of the selector which would cause
Alternatively, we should consider removing the 400 response from the autosaves controller when there are no changes to the autosave, instead treating it as though it were a successful save.
This would arguably be a needless request (a noop), but a preview link could be pulled from its successful response and the user redirected as expected.