faustjs
faustjs copied to clipboard
Bug: Preview link missing `p` and `previewPathName` after saving draft
The preview link is no longer working when you save the draft explicitly.
Applicable Versions
- WordPress plugin version: 1.0.3
- WordPress version: 6.3
Steps To Reproduce
- Create a new page
- Click on "Save draft"
- Click on "Preview" => "Preview in new tab"
The current behavior
Preview link does not contain the faustwp parameters required by the frontend
The expected behavior
Preview link is the the window._faustwp_preview_link._preview_link found in https://github.com/wpengine/faustjs/blob/canary/plugins/faustwp/includes/replacement/previewlinks.js#L8
@stephanonline thank you for the report and apologies for the inconvenience. We're going to prioritize this issue and fix it as soon as possible. We'll update you here when we have more info.
Ahh, interesting, I'm sure you already got here, but it looks like the menu rerenders after the first click and does not make the clones. A workaround in the meantime should be refreshing the page, which should run the preview link replacement script again. Any other action in the editor, like saving again or clicking the preview link seems to re-add the default preview link. See strange behavior when saving w/ the menu open where a duplicate is added.
@JEverhart383 thanks for replying, yes, I found that workaround so it is manageable for now. Although it can be annoying. What I found out is that the button what is referred to in the previewlinks.js is being regenerated and therefor the click event is lost.
Yes the additional link that is being added is a copy with the preview link that faustwp is adding. See here; https://github.com/wpengine/faustjs/blob/canary/plugins/faustwp/includes/replacement/previewlinks.js
Just noting I just saw this on faustjs.org on the overlay that shows when someone is already editing a post. Screenshot:
The preview URL in the overlay is: https://faustjs.org/?post_type=faust_tutorial&p=1070&preview=true.
I can no longer reproduce this bug. It looks like we fixed it in #1644 and/or #1568. @stephanonline if you're still experiencing this in the latest versions of Faust WP and the packages, feel free to reopen.
I don't know if this is related, but am getting this error when trying to preview:
Unhandled Runtime Error Error: The URL must contain the proper "previewPathname" query param for previews.
here's my preview link in WP:
Applicable Versions
WordPress plugin version: 1.2.3 WordPress version: 6.4.3