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
enablePreview does not call all fetch hooks #10483
Comments
Did some digging, and found that if you have https://github.com/nuxt/nuxt.js/blob/dev/packages/vue-app/template/App.js#L185-L192 In addition to skipping https://github.com/nuxt/nuxt.js/blob/dev/packages/vue-app/template/utils.js#L61 @Atinux First off, thanks for the great work! Just wanted to ask if the above behavior is intended, because I would be willing to open a PR to fix it. I got it to work how I wanted locally, but still unsure what is meant by this comment: https://github.com/nuxt/nuxt.js/blob/dev/packages/vue-app/template/utils.js#L61 One of my changes includes removing the |
It should indeed re-call the sub-components fetch normally since it should re-render the components. |
@Atinux Ok great, thanks for the info! I went and opened a PR: #10489 I know you guys are probably busy with Nuxt 3, but would you, or one of the Nuxt team members be able to look at my PR in the coming week? Would love to be able to refactor/improve/fix it if needed and get a patch released if possible. |
Versions
Reproduction
Steps to reproduce
git clone git@github.com:mdoesburg/nuxt-static-fetch-with-preview.git
cd nuxt-static-fetch-with-preview
yarn install
yarn generate
yarn start
http://localhost:3000/
What is Expected?
I expect
fetch
to be called right away (initial load) if preview mode is enabled, not only on a page component but also on a regular component.What is actually happening?
The page component's
fetch
is correctly called right away when preview mode is enabled, but the componentfetch
is only called when navigating.The Nuxt docs say:
Is "page data" in the docs implicitly suggesting that component data does not or should not work with preview mode? If so, it doesn't make sense to me that it does work after navigating to a page that contains a component with
fetch
in preview mode.Related issues
The text was updated successfully, but these errors were encountered: