-
Hi, first of all, thank you for this amazing library. I have a home page which displays a list of sites. When you click on a site, it takes you to the individual site page. https://codesandbox.io/s/pensive-flower-lt235 I have two hooks I tried the Expectation is, when I fetch a list of sites, cache should be updated with entries for individual sites with ids, and when I navigate to the individual site page, data should be fetched from the cache and shouldn't make a network request. Any help appreciated, thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
your code with initialData looks correct, I'm just not seeing anything because the sandbox requests data from can you maybe update the example to be runnable? |
Beta Was this translation helpful? Give feedback.
-
you have a very simple problem: your id is once a number, and once a string. your
which doesn't find anything. It's a number in the cache, but a string when it comes from the url. TypeScript can help here ;) |
Beta Was this translation helpful? Give feedback.
you have a very simple problem: your id is once a number, and once a string. your
find
function does:which doesn't find anything. It's a number in the cache, but a string when it comes from the url. TypeScript can help here ;)