faustjs icon indicating copy to clipboard operation
faustjs copied to clipboard

Bug: Preview link missing `p` and `previewPathName` after saving draft

Open stephanonline opened this issue 2 years ago • 3 comments

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

  1. Create a new page
  2. Click on "Save draft"
  3. 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 avatar Sep 06 '23 10:09 stephanonline

@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.

mindctrl avatar Sep 06 '23 13:09 mindctrl

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. Screenshot 2023-09-06 at 9 51 24 AM Screenshot 2023-09-06 at 9 51 52 AM Screenshot 2023-09-06 at 9 54 33 AM

JEverhart383 avatar Sep 06 '23 13:09 JEverhart383

@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

stephanonline avatar Sep 06 '23 14:09 stephanonline

Just noting I just saw this on faustjs.org on the overlay that shows when someone is already editing a post. Screenshot: image

The preview URL in the overlay is: https://faustjs.org/?post_type=faust_tutorial&p=1070&preview=true.

mindctrl avatar Feb 28 '24 15:02 mindctrl

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.

mindctrl avatar Mar 15 '24 13:03 mindctrl

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: image

Applicable Versions

WordPress plugin version: 1.2.3 WordPress version: 6.4.3

b00y0h avatar Apr 12 '24 21:04 b00y0h