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

State: Avoid URL redirect for published post autosave #7067

merged 1 commit into from Jun 1, 2018


None yet
3 participants

aduth commented May 31, 2018

Fixes #7066

This pull request seeks to resolve an issue where the editor URL is replaced with an autosave ID when autosaves occur for published posts. Since autosave posts are not directly editable, this results in an error message if the user proceeds to reload the page.

Implementation notes:

As part of some consolidation refactoring in #6257, I made assumptions about an autosave success result receiving a post object, which is only partly correct. In fact, the autosave endpoints return a subset of post properties. Notably, this does not include some properties like status, which is considered in both the effects handlers for post save success and failure, and would be undefined in the case of an autosave. Since these handlers seem to handle this gracefully, I did not address that as part of the changes here, but it seems fragile to allow this assumption to continue.

This change was intended to be the minimal fix to allow a 3.0 release to proceed, but I'd like to proceed with future refactorings of this behavior in subsequent pull requests, both:

  • Moving the URL updating logic out of editor to edit-post
  • Updating the post URL in response to RESET_POST, which won't trigger on autosave, only full saves.

Testing instructions:

Repeat steps to reproduce from #7066, verifying that no error screen is presented, and that the browser URL does not change after an autosave occurs for a published post.

Ensure unit tests pass:

npm run test-unit ./editor/store/test/effects.js

@aduth aduth added the [Type] Bug label May 31, 2018

@aduth aduth added this to the 3.0 milestone May 31, 2018

@aduth aduth requested a review from adamsilverstein May 31, 2018


This comment has been minimized.


youknowriad commented Jun 1, 2018

Maybe it's not related to this PR but I'm not seeing the autosave prompt after refreshing the page?


This comment has been minimized.


aduth commented Jun 1, 2018

@youknowriad That's expected. See also #4218, ##4112 (comment) . Maybe if release is by Monday we can see about getting #4218 in as well for a complete autosave experience.


This comment has been minimized.


adamsilverstein commented Jun 1, 2018


@aduth aduth merged commit 3e36b46 into master Jun 1, 2018

2 checks passed

codecov/project 46.32% (+0.01%) compared to 802f890
continuous-integration/travis-ci/pr The Travis CI build passed

@aduth aduth deleted the fix/7066-publish-post-autosave-redirect branch Jun 1, 2018


This comment has been minimized.


aduth commented Jun 1, 2018

Thanks for the review @adamsilverstein !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment