T
TanStack15mo ago
wise-white

log-out/sign-out clarification

What is the recommended way to flush all of the react query data?
3 Replies
extended-salmon
extended-salmon15mo ago
queryClient.clear()
wise-white
wise-whiteOP15mo 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");
extended-salmon
extended-salmon15mo ago
yes clear just calls removeQueries() with no filter, so it removes everything

Did you find this page helpful?