-
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
Fix draft previews #37952
Fix draft previews #37952
Conversation
- Fixes issue with draft post not previwable if the draft was previously published. - During preview link creation, check if current post is in draft status.
- Add end to end test for issue WordPress#33616: Draft post not previewable if the draft was previously published.
- Include a link to the issue that the test validates. - Use aria-label instead of css class as a selector for Title field. - Update test title to be more descriptive about the case under test.
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @jorgecontreras! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
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.
This was previously reviewed on a fork where the PR was accidentally created (Automattic#1), so for anyone looking for more background worth reading that.
Thanks @jorgecontreras for your work here. Also props to @getdave for reviewing that original PR.
Description
Fixes #33616: Draft post not previewable if the draft was previously published.
When the post gets published, an autosave record is generated. Then, if the post is switched to Draft, the generated autosave record becomes stale. Subsequent edits to the post will reflect in the parent record, but not in the autosave record. This condition causes the preview to display the outdated content from the autosave record, which is not up to date with more recent edits. To solve this, the status of the post will be checked during preview link creation and if it's a draft, the autosave record will be ignored.
How has this been tested?
Screenshots
Types of changes
Bug fix
Checklist: