mirror of
https://github.com/toeverything/AFFiNE.git
synced 2025-01-03 12:24:20 +03:00
fix(core): adjust error boundary level (#5493)
Allowing showing page title for page detail when page throws error. ![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/T2klNLEk0wxLh4NRDzhk/398bef13-c52d-40b4-bf53-5157582d030a.png)
This commit is contained in:
parent
922bc11f16
commit
444de6d4ac
@ -79,7 +79,7 @@ const ModalContainer = ({
|
||||
withoutCloseButton
|
||||
contentOptions={contentOptions}
|
||||
>
|
||||
<AffineErrorBoundary>{children}</AffineErrorBoundary>
|
||||
{children}
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
@ -138,12 +138,14 @@ const HistoryEditorPreview = ({
|
||||
</div>
|
||||
|
||||
{snapshotPage ? (
|
||||
<BlockSuiteEditor
|
||||
className={styles.editor}
|
||||
mode={mode}
|
||||
page={snapshotPage}
|
||||
onModeChange={onModeChange}
|
||||
/>
|
||||
<AffineErrorBoundary>
|
||||
<BlockSuiteEditor
|
||||
className={styles.editor}
|
||||
mode={mode}
|
||||
page={snapshotPage}
|
||||
onModeChange={onModeChange}
|
||||
/>
|
||||
</AffineErrorBoundary>
|
||||
) : (
|
||||
<div className={styles.loadingContainer}>
|
||||
<Loading size={24} />
|
||||
|
@ -177,14 +177,17 @@ const DetailPageImpl = memo(function DetailPageImpl({ page }: { page: Page }) {
|
||||
</>
|
||||
}
|
||||
main={
|
||||
<div className={styles.editorContainer}>
|
||||
<PageDetailEditor
|
||||
pageId={currentPageId}
|
||||
onLoad={onLoad}
|
||||
workspace={blockSuiteWorkspace}
|
||||
/>
|
||||
<HubIsland />
|
||||
</div>
|
||||
// Add a key to force rerender when page changed, to avoid error boundary persisting.
|
||||
<AffineErrorBoundary key={currentPageId}>
|
||||
<div className={styles.editorContainer}>
|
||||
<PageDetailEditor
|
||||
pageId={currentPageId}
|
||||
onLoad={onLoad}
|
||||
workspace={blockSuiteWorkspace}
|
||||
/>
|
||||
<HubIsland />
|
||||
</div>
|
||||
</AffineErrorBoundary>
|
||||
}
|
||||
footer={isInTrash ? <TrashPageFooter pageId={page.id} /> : null}
|
||||
sidebar={
|
||||
@ -268,10 +271,5 @@ export const Component = () => {
|
||||
|
||||
const pageId = params.pageId;
|
||||
|
||||
// Add a key to force rerender when page changed, to avoid error boundary persisting.
|
||||
return (
|
||||
<AffineErrorBoundary key={params.pageId}>
|
||||
{pageId ? <DetailPage pageId={pageId} /> : null}
|
||||
</AffineErrorBoundary>
|
||||
);
|
||||
return pageId ? <DetailPage pageId={pageId} /> : null;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user