Not updating data on route change
I'm using NextJS, and for some reason the fetched data not getting updated on route change. For example, if i navigate to
test/1 page, loads the data with id 1, but if i navigate from here to test/100 the data still the same. On codesandbox this code working without any issues, but if i try on VSCode its just broken.
The code looks like this:
And as you can see in the Data Explorer, the data is completely wrong. I appreciate any help.
1 Reply
afraid-scarlet•3y ago
It's the initialData + staleTime combo
https://tkdodo.eu/blog/placeholder-and-initial-data-in-react-query#background-refetches