Fix userload on signout
This commit is contained in:
@ -14,6 +14,7 @@ import { isVerifyPendingState } from '@/auth/states/isVerifyPendingState';
|
||||
import { workspacesState } from '@/auth/states/workspaces';
|
||||
import { authProvidersState } from '@/client-config/states/authProvidersState';
|
||||
import { billingState } from '@/client-config/states/billingState';
|
||||
import { isClientConfigLoadedState } from '@/client-config/states/isClientConfigLoadedState';
|
||||
import { isDebugModeState } from '@/client-config/states/isDebugModeState';
|
||||
import { isSignInPrefilledState } from '@/client-config/states/isSignInPrefilledState';
|
||||
import { supportChatState } from '@/client-config/states/supportChatState';
|
||||
@ -165,8 +166,12 @@ export const useAuth = () => {
|
||||
const supportChat = snapshot.getLoadable(supportChatState).getValue();
|
||||
const telemetry = snapshot.getLoadable(telemetryState).getValue();
|
||||
const isDebugMode = snapshot.getLoadable(isDebugModeState).getValue();
|
||||
const isClientConfigLoaded = snapshot
|
||||
.getLoadable(isClientConfigLoadedState)
|
||||
.getValue();
|
||||
|
||||
const initialSnapshot = emptySnapshot.map(({ set }) => {
|
||||
set(isClientConfigLoadedState, isClientConfigLoaded);
|
||||
set(iconsState, iconsValue);
|
||||
set(authProvidersState, authProvidersValue);
|
||||
set(billingState, billing);
|
||||
|
||||
@ -28,16 +28,18 @@ export const UserProviderEffect = () => {
|
||||
|
||||
const { loading: queryLoading, data: queryData } = useQuery<{
|
||||
currentUser: User;
|
||||
}>(GET_CURRENT_USER, { skip: isCurrentUserLoaded });
|
||||
}>(GET_CURRENT_USER, {
|
||||
skip: isCurrentUserLoaded,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!queryLoading) {
|
||||
setIsLoading(false);
|
||||
setIsCurrentUserLoaded(true);
|
||||
}
|
||||
|
||||
if (!isDefined(queryData?.currentUser)) return;
|
||||
|
||||
setIsCurrentUserLoaded(true);
|
||||
setCurrentUser(queryData.currentUser);
|
||||
setCurrentWorkspace(queryData.currentUser.defaultWorkspace);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user