This repository has been archived by the owner on Apr 6, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1k
feat(nuxt): share asyncData
between calls
#5738
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ix race condition
✅ Deploy Preview for nuxt3-docs canceled.
|
OhB00
changed the title
Share
feat(nuxt): share Jul 5, 2022
asyncData
between callsasyncData
between calls
3rd times a charm |
antfu
suggested changes
Jul 6, 2022
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.
Please revert the formatting changes before we could proceed reviewing.
OhB00
commented
Jul 6, 2022
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.
Reverted formatting changes
danielroe
added
bug
Something isn't working
enhancement
New feature or request
❗ p4-important
Priority 4: bugs that violate documented behavior, or significantly impact perf
labels
Jul 6, 2022
This was referenced Aug 30, 2022
Thanks for your nice PR @OhB00 and sorry it took long to proceed. I have splitted your changes into smaller PR and issues (next times, please consider doing this. this way we can quickly iterate over smaller changes)
Thanks again! |
7 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
3.x
bug
Something isn't working
enhancement
New feature or request
❗ p4-important
Priority 4: bugs that violate documented behavior, or significantly impact perf
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Had a look at nuxt/nuxt#13910 and #5078 and made some changes to improve readability, and fix the race condition mentioned in the issue.
I have also implemented the change suggested in the other pull request to share
asyncData
between calls.🔗 Linked issue
nuxt/nuxt#13910
❓ Type of change
📚 Description
useAsyncData
to use more async await, this (hopefully) makes it much more readable + manageable._nuxtOnBeforeMountCbs
are no longer touched at all server side, data caching is handled top level rather than within refresh,refresh
was simplified with the concept of 'tagging along', if a promise is found for a key, use that instead of calling the handler again.asyncData
is sync'd between calls, for example, if you had auseUserData
composable, that displays user data in two separate components, calling refresh will change both.force
option to refresh, this seems to make more sense then what was provided in the documentation originally, this may be a breaking change.useAsyncData
, as it's fairly easy to break.📝 Checklist