mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 06:16:59 +08:00
fix(core): catch page load error (#6134)
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { DebugLogger } from '@affine/debug';
|
||||
import { DisposableGroup } from '@blocksuite/global/utils';
|
||||
import type { Doc, DocCollection } from '@blocksuite/store';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
const logger = new DebugLogger('use-doc-collection-page');
|
||||
|
||||
export function useDocCollectionPage(
|
||||
docCollection: DocCollection,
|
||||
pageId: string | null
|
||||
@@ -33,7 +36,11 @@ export function useDocCollectionPage(
|
||||
|
||||
useEffect(() => {
|
||||
if (page && !page.loaded) {
|
||||
page.load();
|
||||
try {
|
||||
page.load();
|
||||
} catch (err) {
|
||||
logger.error('Failed to load page', err);
|
||||
}
|
||||
}
|
||||
}, [page]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user