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