Clear cache from React Query on change account

environments/review-clear-cach-jdfmd1/deployments/1449
Chewbacca 2022-11-18 10:25:24 -05:00
rodzic 8d0ebdee17
commit 4c9006609c
1 zmienionych plików z 4 dodań i 0 usunięć

Wyświetl plik

@ -255,6 +255,10 @@ export const logOut = () =>
export const switchAccount = (accountId: string, background = false) =>
(dispatch: AppDispatch, getState: () => RootState) => {
const account = getState().accounts.get(accountId);
// Clear all stored cache from React Query
queryClient.invalidateQueries();
queryClient.clear();
return dispatch({ type: SWITCH_ACCOUNT, account, background });
};