fix(core): adjust error boundary level (#5493)
Allowing showing page title for page detail when page throws error. 
This commit is contained in:
@@ -79,7 +79,7 @@ const ModalContainer = ({
|
|||||||
withoutCloseButton
|
withoutCloseButton
|
||||||
contentOptions={contentOptions}
|
contentOptions={contentOptions}
|
||||||
>
|
>
|
||||||
<AffineErrorBoundary>{children}</AffineErrorBoundary>
|
{children}
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -138,12 +138,14 @@ const HistoryEditorPreview = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{snapshotPage ? (
|
{snapshotPage ? (
|
||||||
<BlockSuiteEditor
|
<AffineErrorBoundary>
|
||||||
className={styles.editor}
|
<BlockSuiteEditor
|
||||||
mode={mode}
|
className={styles.editor}
|
||||||
page={snapshotPage}
|
mode={mode}
|
||||||
onModeChange={onModeChange}
|
page={snapshotPage}
|
||||||
/>
|
onModeChange={onModeChange}
|
||||||
|
/>
|
||||||
|
</AffineErrorBoundary>
|
||||||
) : (
|
) : (
|
||||||
<div className={styles.loadingContainer}>
|
<div className={styles.loadingContainer}>
|
||||||
<Loading size={24} />
|
<Loading size={24} />
|
||||||
|
|||||||
@@ -177,14 +177,17 @@ const DetailPageImpl = memo(function DetailPageImpl({ page }: { page: Page }) {
|
|||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
main={
|
main={
|
||||||
<div className={styles.editorContainer}>
|
// Add a key to force rerender when page changed, to avoid error boundary persisting.
|
||||||
<PageDetailEditor
|
<AffineErrorBoundary key={currentPageId}>
|
||||||
pageId={currentPageId}
|
<div className={styles.editorContainer}>
|
||||||
onLoad={onLoad}
|
<PageDetailEditor
|
||||||
workspace={blockSuiteWorkspace}
|
pageId={currentPageId}
|
||||||
/>
|
onLoad={onLoad}
|
||||||
<HubIsland />
|
workspace={blockSuiteWorkspace}
|
||||||
</div>
|
/>
|
||||||
|
<HubIsland />
|
||||||
|
</div>
|
||||||
|
</AffineErrorBoundary>
|
||||||
}
|
}
|
||||||
footer={isInTrash ? <TrashPageFooter pageId={page.id} /> : null}
|
footer={isInTrash ? <TrashPageFooter pageId={page.id} /> : null}
|
||||||
sidebar={
|
sidebar={
|
||||||
@@ -268,10 +271,5 @@ export const Component = () => {
|
|||||||
|
|
||||||
const pageId = params.pageId;
|
const pageId = params.pageId;
|
||||||
|
|
||||||
// Add a key to force rerender when page changed, to avoid error boundary persisting.
|
return pageId ? <DetailPage pageId={pageId} /> : null;
|
||||||
return (
|
|
||||||
<AffineErrorBoundary key={params.pageId}>
|
|
||||||
{pageId ? <DetailPage pageId={pageId} /> : null}
|
|
||||||
</AffineErrorBoundary>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user