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

Refresh result of useAsyncData with immediate : false when navigation occurs #20979

Closed
3 of 4 tasks
jongmin4943 opened this issue May 21, 2023 · 0 comments · Fixed by #20980
Closed
3 of 4 tasks

Refresh result of useAsyncData with immediate : false when navigation occurs #20979

jongmin4943 opened this issue May 21, 2023 · 0 comments · Fixed by #20980

Comments

@jongmin4943
Copy link
Contributor

Describe the feature

I opened a discussion #20885 a few days ago, no one answered so I decided to dig into that. I was exploring Nuxt and found some clues of my questions.
Since nuxt/framework#8885, when navigation occurs on client-side, useAsyncData ignores cached data and makes a new call (#15445). However, I found that when options gets immediate : false, It uses cached data first. I am not sure it is intended behavior but because of nuxt/framework#8885, the result has to be the same regardless of immediate's value. Which means, when useAsyncData with immediate : false option, call refresh method, move to other page and come back, the result of useAsyncData has to be undefined first, not cached data because it was undefined on the first page loaded.
Additionally, if useAsyncData with lazy: true, default : () => value, it shows default value for the first page loaded, but after moving to other page and coming back, it shows cached data first Instead of default value. I've considered that this is also related to above issue.

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants