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

Preview Mode not working anymore ion step "1st Approach: Full Static with Preview Mode" #99

Open
codeflorist opened this issue Oct 3, 2024 · 0 comments

Comments

@codeflorist
Copy link

codeflorist commented Oct 3, 2024

In the step "1st Approach: Full Static with Preview Mode" of the tutorial Create a Preview Environment for Your Nuxt 3 Website, the following method is used to refetch-the draft version of the useAsyncData in [...slug].vue:

nuxtApp.hook('page:finish', () => { refreshNuxtData() });

This does not seem to be working anymore in the newer Nuxt versions. The solution is originally from this discussion, where the original author also states in a comment in May 2023, that the solution is not working anymore.

Possible solutions:

  1. I think the problem would be easily solvable by adding the version to the useAsyncData key in [...slug].vue.
    So using ${locale.value}-${version}-${url} instead of ${locale.value}-${url}.
    Because then Nuxt has to refetch the draft version on the client in edior mode, since the version variable is different from the server-generated one.

  2. Investigating Nuxt's relatively new composable usePreviewMode for this would probably be a good (maybe best) solution. It has also been suggested by another user in this issue of the storyblok-nuxt package.

  3. The author of the obsolete solution also points to this as an alternative, but imho this is unnecessarily complicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant