-
Notifications
You must be signed in to change notification settings - Fork 10
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: preview mode bugs with preview on unpublished posts #193
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/patronage/bubs-next/9vgU9sjAdWo8sJhE4k9bNPu1sMgM |
One question I had for @kylehotchkiss @chrisherold -- I setup |
some draft posts are previews, but not all.
I'm a fan of using |
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.
I wasn't able to try out the changes myself (please send a link to live version if you'd like me to check). The draft IDs problem and solution both make sense and the changes here for passing around the revision ID/status better seem like a good solve.
closes #192
See #192 for some background on problem, and how I narrowed it down to a preview bug and not a CDN + caching one.
There are 3 issues resolved here:
1: Currently, if you save a theme option headless variable in production, it is ignored (it's only checked on staging). But sometimes we want to test a preview url in prod, like this instance here for debugging.
2: Currently, on an already published page (e.g. post_id = 9, if you make a change and hit preview, you'll be redirected to the revision id, e.g.
/96
. This will then grab the correction preview revision data. However when you click edit, it takes you tohttps://bubsnext.wpengine.com/wp-admin/post.php?action=edit&post=96
, which is an error as it's not a post id. The URL we want to edit instead is:https://bubsnext.wpengine.com/wp-admin/revision.php?revision=96
3: If the page status is draft, and you make a revision then go to preview, the correct behavior is redirect the to go to
/{revisionID}
, e.g./95
. Currently however it sends you to/3
, which loads the orginally saved draft, but doesn't grab your changes.To recreate any of the above, set the theme option for preview URL to
https://bubs.patronage.org
. To verify fixes, set tohttps://bubs-next-git-preview-debug-patronage.vercel.app