-
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
Saving: Autosaveable does not account for autosave existing at start of editing #7416
Labels
[Feature] History
History, undo, redo, revisions, autosave.
[Feature] Saving
Related to saving functionality
[Status] In Progress
Tracking issues with work in progress
[Type] Bug
An existing feature does not function as intended
Milestone
Comments
aduth
added
[Type] Bug
An existing feature does not function as intended
[Feature] Saving
Related to saving functionality
labels
Jun 20, 2018
Thats a good news indeed. Thanks |
Another problematic case with lack of initial autosave described in #7703 |
4 tasks
This was referenced Aug 15, 2018
jorgefilipecosta
added
the
[Status] In Progress
Tracking issues with work in progress
label
Nov 19, 2018
Adding to 5.0.1 since it has a proposal. |
This was referenced Dec 26, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[Feature] History
History, undo, redo, revisions, autosave.
[Feature] Saving
Related to saving functionality
[Status] In Progress
Tracking issues with work in progress
[Type] Bug
An existing feature does not function as intended
Describe the bug
If an autosave revision exists for a published post (or draft authored by another user), and non-content field edits exist,
isEditedPostAutosaveable
wrongly returnstrue
, resulting in a400
bad request response from the autosaves endpoint.To Reproduce
Steps to reproduce the behavior:
Expected 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.
Actual behavior
The "Preview Loading" interstitial is wrongly displayed. A request is sent to the autosaves endpoint and responds with a 400 Bad Request code.
Possible solution
The
isEditedPostAutosaveable
selector returns early withtrue
if there is no known autosave:gutenberg/editor/store/selectors.js
Lines 342 to 345 in 1770317
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
false
to be returned correctly.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.
gutenberg/lib/class-wp-rest-autosaves-controller.php
Line 312 in 1770317
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.
Additional context
Part of ongoing struggles with autosave partly addressed in #7130 and relevant Trac ticket.
The text was updated successfully, but these errors were encountered: