Skip to content

Commit

Permalink
fix(core): reload user session after signing out (#6381)
Browse files Browse the repository at this point in the history
  • Loading branch information
CatsJuice committed Mar 29, 2024
1 parent 0abd246 commit 8dc9455
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/frontend/core/src/providers/modal-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
openSignOutModalAtom,
} from '../atoms';
import { PaymentDisableModal } from '../components/affine/payment-disable';
import { useSession } from '../hooks/affine/use-current-user';
import { useAsyncCallback } from '../hooks/affine-async-hooks';
import { useNavigateHelper } from '../hooks/use-navigate-helper';
import { CurrentWorkspaceService } from '../modules/workspace/current-workspace';
Expand Down Expand Up @@ -221,6 +222,7 @@ export function CurrentWorkspaceModals() {

export const SignOutConfirmModal = () => {
const { openPage } = useNavigateHelper();
const { reload } = useSession();
const [open, setOpen] = useAtom(openSignOutModalAtom);
const currentWorkspace = useLiveData(
useService(CurrentWorkspaceService).currentWorkspace$
Expand All @@ -232,6 +234,7 @@ export const SignOutConfirmModal = () => {
const onConfirm = useAsyncCallback(async () => {
setOpen(false);
await signOutCloud();
await reload();

mixpanel.reset();

Expand All @@ -244,7 +247,7 @@ export const SignOutConfirmModal = () => {
openPage(localWorkspace.id, WorkspaceSubPath.ALL);
}
}
}, [currentWorkspace?.flavour, openPage, setOpen, workspaces]);
}, [currentWorkspace?.flavour, openPage, reload, setOpen, workspaces]);

return (
<SignOutModal open={open} onOpenChange={setOpen} onConfirm={onConfirm} />
Expand Down

0 comments on commit 8dc9455

Please sign in to comment.