react query cache issue
Unanswered
Donskoy posted this in #help-forum
DonskoyOP
I am working on one web application using next js + react tanstack queries.
I have features like user has dashboard of competition and can go in multiple competitions, by changing the competition from sidebar. now when i am in current competition A, i want to cache the data, but when i change to competition B, my data should be cache should be clear and also not call again until I move back to competition A.
I have features like user has dashboard of competition and can go in multiple competitions, by changing the competition from sidebar. now when i am in current competition A, i want to cache the data, but when i change to competition B, my data should be cache should be clear and also not call again until I move back to competition A.
2 Replies
DonskoyOP
in each competition I am caching paginated data
when I add compId in queryKey, and change the competition, it also fetches the data for previous comp A instead of only fetching data for comp B