We used queryClient.invalidateQueries(someQueryKey)
to refetch data in queries and its works well.
Project migrated to Next.js
and router changed from react-router
to next-router
code base stays maximum the same except for router changes.
Now if I navigate from one route to another and then go back, queryClient.invalidateQueries(someQueryKey)
stops working, all other query calls work as it should useQueris and useMutations .
What weird, when I navigate between the pages queries disappear from Query Dev Tools
but continue to work, except of queryClient.invalidateQueries()
. If I refresh the page Query Dev Tools
starts to show me the correct queries and it starts working correctly until I navigate to another route and back.
I'd really appreciate if anyone can help me with this issue! Let me know if any additional info is required.