This repository was archived by the owner on Apr 6, 2023. It is now read-only.
feat(nuxt): share asyncData between calls#5738
Closed
Conversation
…ix race condition
✅ Deploy Preview for nuxt3-docs canceled.
|
asyncData between callsasyncData between calls
Contributor
Author
|
3rd times a charm |
antfu
suggested changes
Jul 6, 2022
Member
antfu
left a comment
There was a problem hiding this comment.
Please revert the formatting changes before we could proceed reviewing.
OhB00
commented
Jul 6, 2022
Contributor
Author
OhB00
left a comment
There was a problem hiding this comment.
Reverted formatting changes
This was referenced Aug 30, 2022
Member
|
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
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
asyncDatabetween calls.🔗 Linked issue
nuxt/nuxt#13910
❓ Type of change
📚 Description
useAsyncDatato use more async await, this (hopefully) makes it much more readable + manageable._nuxtOnBeforeMountCbsare no longer touched at all server side, data caching is handled top level rather than within refresh,refreshwas simplified with the concept of 'tagging along', if a promise is found for a key, use that instead of calling the handler again.asyncDatais sync'd between calls, for example, if you had auseUserDatacomposable, that displays user data in two separate components, calling refresh will change both.forceoption 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