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

fix(vue-app): preview mode fetch #10489

Merged
merged 6 commits into from Jun 23, 2022
Merged

Conversation

mdoesburg
Copy link

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Changes:

1. Make sure all fetch hooks get called properly in preview mode

Prior to this change, if a page component contained a fetch hook, all underlying component fetch hooks would not be called in preview mode. In addition to that, if a component contained a fetch hook and sub components of the component also contained a fetch hook, only the root component fetch hook would be called in preview mode.

2. Make sure that potential asyncData and old fetch hooks resolve prior to any new fetch hook calls in preview mode in accordance with the Nuxt lifecycle diagram

Prior to this change, if you dynamically rendered components based on data from the asyncData hook, and the dynamically rendered components contained a fetch hook, those fetch hooks would not be called, because asyncData, old fetch, and new fetch were all resolving in parallel in preview mode.

Resolves:

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly. (PR: #)
  • I have added tests to cover my changes (if not applicable, please state why)
  • All new and existing tests are passing.

Atinux
Atinux previously approved these changes Jun 13, 2022
Copy link
Member

@Atinux Atinux left a 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

danielroe
danielroe previously approved these changes Jun 22, 2022
Copy link
Member

@danielroe danielroe left a 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.

Copy link
Member

Atinux commented Jun 23, 2022

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?

pi0
pi0 previously approved these changes Jun 23, 2022
Copy link
Member

@pi0 pi0 left a 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.

@pi0
Copy link
Member

pi0 commented Jun 23, 2022

Looks good to me. Pending for #10510 before merging new PRs.

@mdoesburg mdoesburg dismissed stale reviews from pi0, danielroe, and Atinux via 30014fb June 23, 2022 17:57
@codecov-commenter
Copy link

codecov-commenter commented Jun 23, 2022

Codecov Report

Merging #10489 (30014fb) into dev (a10e5dd) will not change coverage.
The diff coverage is n/a.

@@           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           
Flag Coverage Δ
unittests 65.15% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a10e5dd...30014fb. Read the comment docs.

Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

LGTM

@pi0 pi0 merged commit 123206c into nuxt:dev Jun 23, 2022
@danielroe danielroe added the 2.x label Jan 18, 2023
@danielroe danielroe mentioned this pull request Jan 19, 2023
@danielroe danielroe mentioned this pull request Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants