fix: wrap all workspaces with Suspense (#2477)

This commit is contained in:
Himself65 2023-05-22 12:39:07 +08:00 committed by GitHub
parent 752bc9ca0e
commit 41a3d6f62f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -243,12 +243,15 @@ export const WorkspaceLayout: FC<PropsWithChildren> =
(meta && WorkspaceAdapters[meta.flavour].UI.Provider) ?? DefaultProvider; (meta && WorkspaceAdapters[meta.flavour].UI.Provider) ?? DefaultProvider;
return ( return (
<> <>
{/* fixme(himself65): don't re-render whole modals */} {/* load all workspaces is costly, do not block the whole UI */}
<AllWorkspaceContext> <Suspense fallback={null}>
<CurrentWorkspaceContext> <AllWorkspaceContext>
<ModalProvider key={currentWorkspaceId} /> <CurrentWorkspaceContext>
</CurrentWorkspaceContext> {/* fixme(himself65): don't re-render whole modals */}
</AllWorkspaceContext> <ModalProvider key={currentWorkspaceId} />
</CurrentWorkspaceContext>
</AllWorkspaceContext>
</Suspense>
<CurrentWorkspaceContext> <CurrentWorkspaceContext>
<Suspense fallback={<WorkspaceFallback />}> <Suspense fallback={<WorkspaceFallback />}>
<Provider> <Provider>