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;
return (
<>
{/* fixme(himself65): don't re-render whole modals */}
{/* load all workspaces is costly, do not block the whole UI */}
<Suspense fallback={null}>
<AllWorkspaceContext>
<CurrentWorkspaceContext>
{/* fixme(himself65): don't re-render whole modals */}
<ModalProvider key={currentWorkspaceId} />
</CurrentWorkspaceContext>
</AllWorkspaceContext>
</Suspense>
<CurrentWorkspaceContext>
<Suspense fallback={<WorkspaceFallback />}>
<Provider>