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

useLazyAsyncData with initialCache: false is still using cache #14813

Closed
StefanCardnell opened this issue Sep 5, 2022 · 2 comments
Closed

useLazyAsyncData with initialCache: false is still using cache #14813

StefanCardnell opened this issue Sep 5, 2022 · 2 comments

Comments

@StefanCardnell
Copy link

StefanCardnell commented Sep 5, 2022

Environment

  • Operating System: Linux
  • Node Version: v18.5.0
  • Nuxt Version: 3.0.0-rc.9
  • Nitro Version: 0.5.0
  • Package Manager: yarn@1.22.19
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

See stackblitz:

https://stackblitz.com/edit/github-qzajsz

  1. Click "Open In New tab" at the top right and open the dev console in the browser.
  2. Click "OPEN HOME"
  3. See that "DATA VAL" logged is null in the dev console.
  4. Click "GO BACK TO HOME" and then click "OPEN COMPONENT" again
  5. See that "DATA VAL" is not null and has the value from the first time opening the component.

Describe the bug

Despite initialCache being specified in the API in page1.vue, when returning back to the page a second time the cached value is used initially.

You can see that "NEW DATA VAL" is logged indicating that the data is eventually replaced by new fetched data.

However on the initial load, the data should be null and not be given old data.

Additional context

On my production app, this means users see old data when returning back to a page before it is replaced by new data.

Normally I replace the data with a loading spinner when data === null, however since data is not null this does not appear.

Logs

No response

@516310460
Copy link
Contributor

Thanks

@danielroe
Copy link
Member

useFetch no longer supports initialCache.

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants