question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

useFetch data is not being cached anymore

See original GitHub issue

Environment


  • Operating System: Darwin
  • Node Version: v16.14.2
  • Nuxt Version: 3.0.0-rc.14-27802701.2f53495
  • Nitro Version: 0.6.2-27796963.837f894
  • Package Manager: npm@8.8.0
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-ccqtvp?file=pages%2Fabout.vue,pages%2Findex.vue,package.json

As you can see, on rc.14 edge if you click “Go to about page” then “Go to home”, you will see that the data will be fetched again. If you change to rc.13, the data won’t be fetched again, loading from cache.

Describe the bug

Everytime useFetch is being called, it ma dke a new request, it is not checking for the fetched cached data, as it used to be working by rc.13

Additional context

No response

Logs

No response

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:1
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

13reactions
vanlingcommented, Nov 18, 2022

I’ve wasted some time today trying to figure out why i was seeing data refetched on back and forth page navigation hehehe. Thought i was going insane and broke something in my datafetching. I thought the built in caching was awesome!

8reactions
DNAcommented, Nov 18, 2022

You can implement your own custom cache behaviour by using useAsyncData.

That would be a lot of boilerplate code instead of a one-liner, @danielroe… Is this cache removal a final design decision or it is related to the ongoing discussion on #7569? 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

useFetch
Stops making more requests if there is no more data to fetch. (i.e. if we have 25 todos, and the perPage is 10,...
Read more >
useFetch in Nuxt3 keeping cached data - vue.js - Stack Overflow
when I move away from the page and come back, the new data is not loaded, instead it still shows the old data....
Read more >
React Hooks SWR: Fetch, Cache and ReValidate server data ...
We'll see how to use SWR to improve the User Experience of our applications.We'll be using the following techniques in this tutorial:- cache...
Read more >
@codecolde/use-fetch - npm
Use-Fetch. A very simple react hook. The goal is to fetch data from a url and optionally store it in the browser using...
Read more >
React Query 3: A Guide to Fetching and Managing Data
For every API endpoint, you'll need to deal with state management, synchronization, caching and error handling. In this article, you'll learn ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found