TanStackT
TanStack2y ago
14 replies
spotty-amber

How Does removeQueries work with placeholderData:KeepPreviousData??

Hey everyone. I'm trying to build an application where user can have business accounts. Business Account are what drives the 90% of my application. Change in Business Account should remove all the cached queries and fetch settings data to provide globally. The Issue I am facing is with queryClient.removeQueries and placeholderData:keepPreviousData. Every time I switch business. All the cached data get's removed but the page that I am currently In uses the previousQuery data until the data for the new business resolves resulting into isLoading being false and isPlaceholderData being true. What I want is to show Skeleton in every places when ever the business get's changed.

Here is a minimal reproduction
https://codesandbox.io/p/sandbox/demo-4wvwr4?file=%2Fsrc%2FApp.js
Was this page helpful?