fix: infinite loading on public workspace (#1074)

This commit is contained in:
Himself65
2023-02-16 15:56:23 -06:00
committed by GitHub
parent 6fa04622ce
commit 1d0bf58109

View File

@@ -1,4 +1,4 @@
import { ReactElement, useEffect, useMemo, useState } from 'react'; import { ReactElement, useEffect, useMemo } from 'react';
import type { NextPageWithLayout } from '../..//_app'; import type { NextPageWithLayout } from '../..//_app';
import { displayFlex, styled } from '@affine/component'; import { displayFlex, styled } from '@affine/component';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
@@ -22,7 +22,6 @@ const Page: NextPageWithLayout = () => {
const { workspaceId, pageId } = router.query as Record<string, string>; const { workspaceId, pageId } = router.query as Record<string, string>;
const { status, workspace: workspaceUnit } = const { status, workspace: workspaceUnit } =
useLoadPublicWorkspace(workspaceId); useLoadPublicWorkspace(workspaceId);
const [editorLoaded, setEditorLoaded] = useState(false);
const { triggerQuickSearchModal } = useModal(); const { triggerQuickSearchModal } = useModal();
const { t } = useTranslation(); const { t } = useTranslation();
@@ -50,7 +49,7 @@ const Page: NextPageWithLayout = () => {
} }
}, [router, status]); }, [router, status]);
if (status === 'loading' || !editorLoaded) { if (status === 'loading') {
return <PageLoading />; return <PageLoading />;
} }
@@ -91,7 +90,6 @@ const Page: NextPageWithLayout = () => {
workspace={workspace} workspace={workspace}
setEditor={editor => { setEditor={editor => {
editor.readonly = true; editor.readonly = true;
setEditorLoaded(true);
}} }}
/> />
)} )}