fix(core): fix app boot speed (#5884)

This commit is contained in:
EYHN
2024-02-23 13:54:42 +07:00
committed by GitHub
parent 5ae8f029f7
commit 640aa00148
2 changed files with 6 additions and 8 deletions
+3 -7
View File
@@ -1,9 +1,6 @@
import { Menu } from '@affine/component/ui/menu';
import { WorkspaceFallback } from '@affine/component/workspace';
import {
workspaceListAtom,
workspaceListLoadingStatusAtom,
} from '@affine/core/modules/workspace';
import { workspaceListAtom } from '@affine/core/modules/workspace';
import { WorkspaceSubPath } from '@affine/core/shared';
import { useAtomValue } from 'jotai';
import { lazy, useEffect, useLayoutEffect, useState } from 'react';
@@ -33,12 +30,11 @@ export const Component = () => {
const [creating, setCreating] = useState(false);
const list = useAtomValue(workspaceListAtom);
const listLoading = useAtomValue(workspaceListLoadingStatusAtom);
const { openPage } = useNavigateHelper();
useLayoutEffect(() => {
if (list.length === 0 || listLoading) {
if (list.length === 0) {
return;
}
@@ -47,7 +43,7 @@ export const Component = () => {
const openWorkspace = list.find(w => w.id === lastId) ?? list[0];
openPage(openWorkspace.id, WorkspaceSubPath.ALL);
setNavigating(true);
}, [list, listLoading, openPage]);
}, [list, openPage]);
useEffect(() => {
setCreating(true);
@@ -202,7 +202,9 @@ export const SignOutConfirmModal = () => {
const onConfirm = useAsyncCallback(async () => {
setOpen(false);
await signOutCloud();
await signOutCloud({
redirect: false,
});
// if current workspace is affine cloud, switch to local workspace
if (currentWorkspace?.flavour === WorkspaceFlavour.AFFINE_CLOUD) {