fix(core): reload user session after signing out (#6381)

This commit is contained in:
CatsJuice 2024-03-29 03:47:18 +00:00
parent c078f32a83
commit f1c70d5df0
No known key found for this signature in database
GPG Key ID: 1C1E76924FAFDDE4

View File

@ -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';
@ -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$
@ -232,6 +234,7 @@ export const SignOutConfirmModal = () => {
const onConfirm = useAsyncCallback(async () => {
setOpen(false);
await signOutCloud();
await reload();
mixpanel.reset();
@ -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} />