Skip to content
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

Bug: Preview link missing p and previewPathName after saving draft #1561

Closed
stephanonline opened this issue Sep 6, 2023 · 6 comments
Closed
Assignees
Labels
type: bug Issue that causes incorrect or unexpected behavior

Comments

@stephanonline
Copy link

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

@theodesp theodesp added needs: reproduction This issue needs to be reproduced independently needs triage type: bug Issue that causes incorrect or unexpected behavior and removed needs: reproduction This issue needs to be reproduced independently needs triage labels Sep 6, 2023
@mindctrl
Copy link
Contributor

mindctrl commented Sep 6, 2023

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

@JEverhart383
Copy link

JEverhart383 commented Sep 6, 2023

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

@stephanonline
Copy link
Author

stephanonline commented Sep 6, 2023

@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

@mindctrl
Copy link
Contributor

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 mindctrl self-assigned this Mar 15, 2024
@mindctrl
Copy link
Contributor

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.

@b00y0h
Copy link

b00y0h commented Apr 12, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Issue that causes incorrect or unexpected behavior
Projects
None yet
Development

No branches or pull requests

6 participants