I have query to get user data (roles, username)
const token = getCookie(CookieNames.TOKEN);
const { data, refetch, loading } = useUserGetCurrentQuery({
skip: !token,
});
Also I have storeClearing on logout
export const logout = async () => {
const apolloClient = initializeApollo();
removeCookie(CookieNames.TOKEN);
localStorage.deleteItem('refreshToken');
logoutEvent();
await apolloClient.clearStore();
await redirect({ route: routes.AUTH });
};
After cache clearing on auth page we call getUserData hook. As token is empty I expected, what query will skipped and data would be undefined. But it still returns old data, cache is clear though.
Any help please, I blew my mind