T
TanStack3y ago
absent-sapphire

Managing case when query is dependent on nextjs router.query but should update conditionally

What I want to achieve is that my query keys are dependent on router.query and not change if react.query.isTab is the same. It is a true false value, Currently whenever I click on any Tab in as shown in SS1 the nav bar is lost because mesages from that channels are fetched, I need to maintain some sort of state say react.query.isTab so that the nav bar data doesnt update if users is switching between the tabs. It should only update if users search for a new query,
No description
No description
1 Reply
like-gold
like-gold3y ago
Hi, you might need to add a staleTime > 0 on your query Without, as soon as your data are fetched, they are considered stale

Did you find this page helpful?