Clear cache from React Query on change account
This commit is contained in:
parent
8d0ebdee17
commit
4c9006609c
|
@ -255,6 +255,10 @@ export const logOut = () =>
|
||||||
export const switchAccount = (accountId: string, background = false) =>
|
export const switchAccount = (accountId: string, background = false) =>
|
||||||
(dispatch: AppDispatch, getState: () => RootState) => {
|
(dispatch: AppDispatch, getState: () => RootState) => {
|
||||||
const account = getState().accounts.get(accountId);
|
const account = getState().accounts.get(accountId);
|
||||||
|
// Clear all stored cache from React Query
|
||||||
|
queryClient.invalidateQueries();
|
||||||
|
queryClient.clear();
|
||||||
|
|
||||||
return dispatch({ type: SWITCH_ACCOUNT, account, background });
|
return dispatch({ type: SWITCH_ACCOUNT, account, background });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue