Bug: Preview Mode Not Reflecting Updated Content in Next.js v13
Hey! I'm currently in the process of migrating a Next.js v12 application to v13, which is using the "@wpengine/headless" package at version 0.6.3. I understand that this version is deprecated, but for now, I need to work with it until I can update it to a newer version. During the migration, I realized that the "preview" mode feature in the WordPress dashboard is not working as expected in the application I'm building.
Applicable Versions
@wpengine/headless version: 0.6.3 react version: 18.2.0 react-dom version: 18.2.0
Steps To Reproduce
-
Update a title on a page in the WordPress dashboard.
-
Press the "preview" button.
-
The page opens in a new tab with the URL "https://my-awsome-app.com/?preview=true&p=22178&page_id=22178".
-
Notice that the changes made in the title are not reflected in the preview.
Example for a page query `import { gql } from '@apollo/client'; import { SEOFragment } from './SEO.fragment';
export const HomePageQuery = gql${SEOFragment} query HomePage { page(id: "/", idType: URI) { id seo { ...SEO } homepage { // Query details here... } } };
`
The current behavior
changes made in any page are not reflected in the preview. The preview appears to be showing the page as it was before the update...
I believe I need to make some changes in my code base to support the preview mode, but I'm not sure how to proceed. I'd appreciate it if someone from the community or the maintainers could provide some guidance on how I can enable and handle the preview mode in my Next.js v13 application.
Best regards, Aviv
Hello @avivdaniel . Thank you for the report. What version of the FaustWP WP plugin are you using? There might be some incompatible changes to consider.
@avivdaniel pinging in case you missed the questions from @theodesp. Let us know if you have any more info or still experiencing issues, otherwise we'll close this out soon if you're still not having issues.
@theodesp I'm also facing this issue. I'm running the following version:
- WordPress 6.5.2
- Faust plugin 1.2.3
- WPGraphQL plugin 1.24.0
- WPGraphQL Smart Cache plugin 1.3.2
- Next 14.0.4
- @faustwp/core 3.0.1
As far as I can tell this is an issue with browser cache not being bypassed when previewing pages. If I open the Network tab in chrome dev tools and check "Disable cache" the correct preview data is loaded.