mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-12 23:56:36 +08:00
fix(core): fix app boot speed (#5884)
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user