-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
feat(vue-app): support custom fetchKey
for full static generation
#8466
Conversation
* nb: this may be a deliberate choice users make
Codecov Report
@@ Coverage Diff @@
## dev #8466 +/- ##
=======================================
Coverage 67.95% 67.95%
=======================================
Files 91 91
Lines 3916 3916
Branches 1069 1069
=======================================
Hits 2661 2661
Misses 1016 1016
Partials 239 239
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
I do think we will need tests to ensure the correct behaviour for this and avoid any regression in the future, so far great work @danielroe 👏 |
Updates:
|
* relates to nuxt/nuxt#8466
Co-authored-by: pooya parsa <pyapar@gmail.com>
PLEASE PLEASE PLEASE merge this! Solves so many problems for us at https://github.com/funkhaus |
Merged. Should be available soon on |
@pi0 Thanks for doing this! Is there a guide or tips on how to use |
@drewbaker Simply remove |
* docs: add documentation for `fetchKey` * relates to nuxt/nuxt#8466 * docs: add link to PR
This no longer works in |
OMG this solved my issue (and probably many others more where I had to go for workaround)! Thank you so much @danielroe I've now spend 3 full days on solving this, because even after many learnings nuxt SSG and SSR is pretty much still a blockbox for me. So feedback from a noob: That includes questions like:
If there is a resource going in depth on this, I apologize and would kindly suggest to make it more prominent. I personally expected something like EDIT: I'd gladly act as a punching ball or sparring partner, if you guys like. You want to know what noobs think? I have all the noob questions! |
* docs: add documentation for `fetchKey` * relates to nuxt/nuxt#8466 * docs: add link to PR
That was an absolutely shameless plug. |
* docs: add documentation for `fetchKey` * relates to nuxt/nuxt#8466 * docs: add link to PR
@danielroe @atinux |
Same problem... @danielroe @pi0 any help? |
Previous behaviour
Previously, fetch payloads were assigned to the components that needed them through a sequential method. When a page changed, the payload array was loaded and a global
fetchKey
was initialised to0
. As components are created and need data, this key increases and the relevant array item is injected into each component.This posed a problem when components persist between pages, such as when there is a parent/child page, or if a user would like to use
fetch
in a global layout. In this case, the persistent component never rerenders, and so the component that would normally be keyed1
was assigned the0
-indexed payload, and so on.New behaviour
We are improving hydration by:
Keying fetch payloads with a non-numeric fetchKey. This will default to the scope ID (if the component uses scoped CSS), the component name, if there is one, or an auto-incrementing number (as at present).
Allow the user to manually take control of the fetch hydration process, by specifying their own
fetchKey
Additional context
Will close #7563, #7791, #7799, #8107, #8150, #8193.
Types of change
Checklist:
fetchKey
website-v2#1087)