diff --git a/app/soapbox/actions/auth.ts b/app/soapbox/actions/auth.ts index 5539fd96f1..f660529d38 100644 --- a/app/soapbox/actions/auth.ts +++ b/app/soapbox/actions/auth.ts @@ -16,6 +16,7 @@ import { obtainOAuthToken, revokeOAuthToken } from 'soapbox/actions/oauth'; import { startOnboarding } from 'soapbox/actions/onboarding'; import snackbar from 'soapbox/actions/snackbar'; import { custom } from 'soapbox/custom'; +import { queryClient } from 'soapbox/queries/client'; import KVStore from 'soapbox/storage/kv-store'; import { getLoggedInAccount, parseBaseURL } from 'soapbox/utils/auth'; import sourceCode from 'soapbox/utils/code'; @@ -237,10 +238,16 @@ export const logOut = () => token: state.auth.getIn(['users', account.url, 'access_token']), }; - return dispatch(revokeOAuthToken(params)).finally(() => { - dispatch({ type: AUTH_LOGGED_OUT, account, standalone }); - return dispatch(snackbar.success(messages.loggedOut)); - }); + return dispatch(revokeOAuthToken(params)) + .finally(() => { + // Clear all stored cache from React Query + queryClient.invalidateQueries(); + queryClient.clear(); + + dispatch({ type: AUTH_LOGGED_OUT, account, standalone }); + + return dispatch(snackbar.success(messages.loggedOut)); + }); }; export const switchAccount = (accountId: string, background = false) =>