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
fix(vue-app): preview mode fetch #10489
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, will need a second eye on this from @danielroe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me - nice changes.
The one question I have is about the comment on https://github.com/nuxt/nuxt.js/blob/0742f59e2478bd3998fd4d49b6200584ee5e2721/packages/vue-app/template/utils.js#L61 but if you're happy with this @Atinux then I am too.
I think it's fine to reload the templates when we do a full refresh on preview mode. @pi0 do you want to take a look at it or happy to merge and let people use it with nuxt-edge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good to me. We are introducing a behavior change that but it makes lifecycle more explicit can only slightly affect performance in cases usage was depending on the parallel run.
Looks good to me. Pending for #10510 before merging new PRs. |
Codecov Report
@@ Coverage Diff @@
## dev #10489 +/- ##
=======================================
Coverage 65.15% 65.15%
=======================================
Files 94 94
Lines 4155 4155
Branches 1172 1172
=======================================
Hits 2707 2707
Misses 1169 1169
Partials 279 279
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Types of changes
Description
Changes:
1. Make sure all
fetch
hooks get called properly in preview modePrior to this change, if a page component contained a
fetch
hook, all underlying componentfetch
hooks would not be called in preview mode. In addition to that, if a component contained afetch
hook and sub components of the component also contained afetch
hook, only the root componentfetch
hook would be called in preview mode.2. Make sure that potential
asyncData
and oldfetch
hooks resolve prior to any newfetch
hook calls in preview mode in accordance with the Nuxt lifecycle diagramPrior to this change, if you dynamically rendered components based on data from the
asyncData
hook, and the dynamically rendered components contained afetch
hook, thosefetch
hooks would not be called, becauseasyncData
, oldfetch
, and newfetch
were all resolving in parallel in preview mode.Resolves:
Checklist: