mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
fix: wrap React.lazy with Suspense (#1915)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { NoSsr } from '@mui/material';
|
||||
import { useRouter } from 'next/router';
|
||||
import { lazy } from 'react';
|
||||
import { lazy, Suspense } from 'react';
|
||||
|
||||
import { StyledPage, StyledWrapper } from '../../layouts/styles';
|
||||
import type { NextPageWithLayout } from '../../shared';
|
||||
@@ -26,7 +26,9 @@ const InitPagePage: NextPageWithLayout = () => {
|
||||
return (
|
||||
<StyledPage>
|
||||
<StyledWrapper>
|
||||
<Editor onInit={initPage} testType={testType} />
|
||||
<Suspense>
|
||||
<Editor onInit={initPage} testType={testType} />
|
||||
</Suspense>
|
||||
<div id="toolWrapper" />
|
||||
</StyledWrapper>
|
||||
</StyledPage>
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
} from '@affine/workspace/affine/login';
|
||||
import { useAtom } from 'jotai';
|
||||
import type { NextPage } from 'next';
|
||||
import { lazy, useMemo } from 'react';
|
||||
import { lazy, Suspense, useMemo } from 'react';
|
||||
|
||||
import { toast } from '../../utils';
|
||||
|
||||
@@ -91,10 +91,12 @@ const LoginDevPage: NextPage = () => {
|
||||
>
|
||||
Check Permission
|
||||
</Button>
|
||||
<Viewer
|
||||
theme={useTheme().resolvedTheme === 'light' ? 'light' : 'dark'}
|
||||
value={user}
|
||||
/>
|
||||
<Suspense>
|
||||
<Viewer
|
||||
theme={useTheme().resolvedTheme === 'light' ? 'light' : 'dark'}
|
||||
value={user}
|
||||
/>
|
||||
</Suspense>
|
||||
</StyledWrapper>
|
||||
</StyledPage>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user