-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Autosaves: Create a separate revision when autosaving a draft #26345
Conversation
3474adb
to
20d02ee
Compare
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.
e2e tests are fine on this one - just expecting the "Import" option which is in master but not this PR |
parent: post.ID, | ||
status: 'inherit', | ||
type: 'revision', | ||
} ); |
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.
The savePost
action dispatches POST_SAVE
, POST_SAVE_SUCCESS
and POSTS_RECEIVE
while saving the post or revision. That updates the structures in state.posts
. And the revision doesn't really belong there.
It doesn't immediately break anything, just adds more entropy to already complex and fragile code.
It would be better to directly call wpcom.site().post().add()
in the saveRevision
action thunk, without the extra dispatches.
fe8f2ea
to
a7a3020
Compare
I'm going to go ahead and close this. To prevent superfluous network requests, we're pursuing a server-side solution in:
|
As of #19261, we are passing the
autosave
param to the API when the Editor saves its buffer. That param results in theDOING_AUTOSAVE
constant getting set &, consequently, revisions are not saved for drafts unless theSave
button is explicitly clicked.This change conditionally initiates a separate request to save a revision for drafts when they're autosaved.
Fixes #20265
Additionally, this stops showing the autosave
<RestorePostDialog />
when relevant fields are identical.To Test
Save
button to change toSaved
History
button should appear when there are revisions & you should see a revision for your edits)