fix(core): dont break workspace when page load failed (#5988)
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
|
import { DebugLogger } from '@affine/debug';
|
||||||
import { DisposableGroup } from '@blocksuite/global/utils';
|
import { DisposableGroup } from '@blocksuite/global/utils';
|
||||||
import type { Doc, Workspace } from '@blocksuite/store';
|
import type { Doc, Workspace } from '@blocksuite/store';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
|
const logger = new DebugLogger('useBlockSuiteWorkspacePage');
|
||||||
|
|
||||||
export function useBlockSuiteWorkspacePage(
|
export function useBlockSuiteWorkspacePage(
|
||||||
blockSuiteWorkspace: Workspace,
|
blockSuiteWorkspace: Workspace,
|
||||||
pageId: string | null
|
pageId: string | null
|
||||||
@@ -33,7 +36,11 @@ export function useBlockSuiteWorkspacePage(
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (page && !page.loaded) {
|
if (page && !page.loaded) {
|
||||||
page.load();
|
try {
|
||||||
|
page.load();
|
||||||
|
} catch (err) {
|
||||||
|
logger.error('Failed to load page', err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [page]);
|
}, [page]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user