T
TanStack12mo ago
stormy-gold

log-out/sign-out clarification

What is the recommended way to flush all of the react query data?
3 Replies
like-gold
like-gold12mo ago
queryClient.clear()
stormy-gold
stormy-goldOP12mo ago
I saw approaches like the below for logout related code. Is this just a way to clear data explicitly? So if i have data that authenticated and public users can see, i don't need to clear those and I could use this approach to clear sentive data?
client = useQueryClient();
client.removeQueries("repoData");
client = useQueryClient();
client.removeQueries("repoData");
like-gold
like-gold12mo ago
yes clear just calls removeQueries() with no filter, so it removes everything

Did you find this page helpful?