# \`resetStore()\` behavior and sign-out best practices

**URL:** <https://community.apollographql.com/t/resetstore-behavior-and-sign-out-best-practices/7328>\
**Category:** Client SDKs\
**Tags:** client, web\
**Created:** [March 25, 2024, 11:21pm UTC](https://community.apollographql.com/t/resetstore-behavior-and-sign-out-best-practices/7328 "2024-03-25T23:21:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreimatei](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/andreimatei/32/4476_2.png) [@andreimatei](https://community.apollographql.com/u/andreimatei)\
**Post date:** [March 25, 2024, 11:21pm UTC](https://community.apollographql.com/t/resetstore-behavior-and-sign-out-best-practices/7328/1 "2024-03-25T23:21:53Z")

</div>

Hello!

I’m implementing signing-out functionality for my app, and I’m curious if there is an elegant pattern in this area. I’m using `client.resetStore()` on sign-out so that future queries do not use old data. The issue is that `resetStore()` triggers all the active queries to be refetched. Immediately after sign-out, all my queries fail because the required authorization token no longer exists. I wonder if there’s a way to avoid running these queries at all, knowing that they will fail. The thing is that, in my app, the results of these queries will no longer be rendered after a sign-out, so the queries are refetched (and fail) for no reason. The behavior that I think I would want would be to clear the set of active queries: if any result of a, say, `useQuery` is needed from this moment on, I want the respective query to go back to the loading state and be fetched from the server - but only if the result of a `useQuery` is needed (which, in practice, I know it won’t be until a new sign-in happens).

I know that `client.clearStore()` also exists, and that one does not cause active queries to be re-fetched. The problem with that one, though, is that active `useQuery's` from before the `clearStore()` call return old results after the `clearStore()`. So that’s not good either. I guess I want something in between – I want `resetStore()` to act like a barrier, but I don’t want it to eagerly refetch anything.

Does this make any sense / am I missing something?

Thanks a lot!
