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

[Merl 1256] Bug fix. Generate Autosave is missing from Post/Page Previews #1644

Merged
merged 21 commits into from
Nov 27, 2023

Conversation

theodesp
Copy link
Member

Tasks

  • I have signed a Contributor License Agreement (CLA) with WP Engine.
  • If a code change, I have written testing instructions that the whole team & outside contributors can understand.
  • I have written and included a comprehensive changeset to properly document the changes I've made.

Description

Fixes missing call to autosave when clicking on the Preview links.

Related Issue(s):

Testing

  1. Checkout this branch that includes changes to the faustwp plugin
  2. Using the updated faustwp plugin, create a new post & save as draft (do not publish)
  3. Observe that both preview links correctly resolve to display draft content.
  4. Verify that the draft content is also presented in the headless site.

Screenshots

Documentation Changes

Dependant PRs

@theodesp theodesp requested a review from a team as a code owner November 13, 2023 13:51
Copy link

changeset-bot bot commented Nov 13, 2023

🦋 Changeset detected

Latest commit: d6fbf56

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@faustwp/wordpress-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Nov 13, 2023

📦 Next.js Bundle Analysis for @faustwp/getting-started-example

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

if (headerLink && headerLink.getAttribute('href') !== faustPreviewLink) {
const clonedHeaderLink = headerLink.cloneNode(true);
Copy link
Member Author

@theodesp theodesp Nov 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DOM modifications are not allowed under a React managed DOM

Screenshot 2023-11-13 at 13 32 12

@blakewilson
Copy link
Contributor

@theodesp I've tested this and both existing previews and draft previews no longer work for me.

When requesting an existing post preview, the post comes back as null:
Screenshot 2023-11-13 at 8 32 02 AM

When requesting a new draft post, the previewPathname is no longer being added to the URL, which is causing an error on the Faust/Next side to be thrown. Oddly, when hovering over the preview button you can see in the bottom left corner, the URL does include the previewPathname:
Screenshot 2023-11-13 at 8 27 35 AM

But once the link is clicked, it is removed from the URL:
Screenshot 2023-11-13 at 8 27 51 AM

package.json Outdated Show resolved Hide resolved
@theodesp
Copy link
Member Author

@blakewilson I've updated the code. It should work now:

Screen.Recording.2023-11-14.at.10.58.26.mp4

@theodesp theodesp requested a review from mindctrl November 14, 2023 11:10
@theodesp
Copy link
Member Author

Lint error looks like relevant to this

woocommerce/woocommerce-sniffs#34

Need to investigate

@blakewilson
Copy link
Contributor

@theodesp I've tested this and both existing previews and draft previews no longer work for me.

When requesting an existing post preview, the post comes back as null: Screenshot 2023-11-13 at 8 32 02 AM

When requesting a new draft post, the previewPathname is no longer being added to the URL, which is causing an error on the Faust/Next side to be thrown. Oddly, when hovering over the preview button you can see in the bottom left corner, the URL does include the previewPathname: Screenshot 2023-11-13 at 8 27 35 AM

But once the link is clicked, it is removed from the URL: Screenshot 2023-11-13 at 8 27 51 AM

I've realized this was due to a bug in Faust/Safari, so this may be unrelated.

Copy link
Contributor

@blakewilson blakewilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @theodesp! I've tested locally for published posts and draft posts and both work as expected.

Copy link
Contributor

@mindctrl mindctrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left comment about tests. Also there's a merge conflict now.

@josephfusco josephfusco added the package: faustwp Related to the companion WordPress plugin label Nov 16, 2023
@TeresaGobble
Copy link
Contributor

Apologies for accidentally closing this, typing in github and my focus jumped to close with comment.

@theodesp theodesp merged commit 2559958 into canary Nov 27, 2023
18 checks passed
@theodesp theodesp deleted the MERL-1256 branch November 27, 2023 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: faustwp Related to the companion WordPress plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants