Skip to content
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

Autosave: Refreshing the screen after a published post autosave lands on error page #7066

Closed
aduth opened this issue May 31, 2018 · 0 comments · Fixed by #7067
Closed

Autosave: Refreshing the screen after a published post autosave lands on error page #7066

aduth opened this issue May 31, 2018 · 0 comments · Fixed by #7067
Assignees
Labels
[Type] Bug An existing feature does not function as intended
Milestone

Comments

@aduth
Copy link
Member

aduth commented May 31, 2018

Describe the bug

An error page is shown if the user reloads the page after an autosave has occurred for a published post.

image

To Reproduce

  1. Navigate to Posts > Add New
  2. Enter a title and/or content
  3. Publish the post
  4. Change the title or content
  5. Wait for autosave to occur
    • From what I can tell, there is no UI indication. It takes place after 10 seconds. You can watch your developer tools Network tab for the /autosaves POST request
  6. Refresh the page
    • Accept the prompt

Expected behavior

I'm presented with the editor. Presumably in the state of the last publish, with a prompt for a newer autosave existing.

Suspected cause

Probably because the autosave is saved as a separate post entity, with its own ID, and since it's different and the post is published, we replace the browser's current URL with that of the autosave post ID, which isn't valid to be edited directly (only its parent).

if ( get( window.history.state, [ 'id' ] ) !== post.id ) {
window.history.replaceState(
{ id: post.id },
'Post ' + post.id,
getPostEditUrl( post.id )
);
}

cc @adamsilverstein

@aduth aduth added the [Type] Bug An existing feature does not function as intended label May 31, 2018
@aduth aduth added this to the 3.0 milestone May 31, 2018
@aduth aduth self-assigned this May 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant