mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
fix: logic after delete all workspaces (#2587)
Co-authored-by: JimmFly <yangjinfei001@gmail.com>
This commit is contained in:
@@ -58,7 +58,10 @@ import { useCurrentWorkspace } from '../hooks/current/use-current-workspace';
|
||||
import { useRouterHelper } from '../hooks/use-router-helper';
|
||||
import { useRouterTitle } from '../hooks/use-router-title';
|
||||
import { useWorkspaces } from '../hooks/use-workspaces';
|
||||
import { ModalProvider } from '../providers/modal-provider';
|
||||
import {
|
||||
AllWorkspaceModals,
|
||||
CurrentWorkspaceModals,
|
||||
} from '../providers/modal-provider';
|
||||
import { pathGenerator, publicPathGenerator } from '../shared';
|
||||
import { toast } from '../utils';
|
||||
|
||||
@@ -178,7 +181,10 @@ export const CurrentWorkspaceContext = ({
|
||||
return () => {
|
||||
clearTimeout(id);
|
||||
};
|
||||
}, [push, exist]);
|
||||
}, [push, exist, metadata.length]);
|
||||
if (metadata.length === 0) {
|
||||
return <WorkspaceFallback key="no-workspace" />;
|
||||
}
|
||||
if (!router.isReady) {
|
||||
return <WorkspaceFallback key="router-is-loading" />;
|
||||
}
|
||||
@@ -266,9 +272,10 @@ export const WorkspaceLayout: FC<PropsWithChildren> =
|
||||
{/* load all workspaces is costly, do not block the whole UI */}
|
||||
<Suspense fallback={null}>
|
||||
<AllWorkspaceContext>
|
||||
<AllWorkspaceModals />
|
||||
<CurrentWorkspaceContext>
|
||||
{/* fixme(himself65): don't re-render whole modals */}
|
||||
<ModalProvider key={currentWorkspaceId} />
|
||||
<CurrentWorkspaceModals key={currentWorkspaceId} />
|
||||
</CurrentWorkspaceContext>
|
||||
</AllWorkspaceContext>
|
||||
</Suspense>
|
||||
|
||||
Reference in New Issue
Block a user