From 444de6d4ac821371bc11806807fadf1da244da1b Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Tue, 2 Jan 2024 13:20:13 +0000 Subject: [PATCH] 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) --- .../page-history-modal/history-modal.tsx | 16 +++++++----- .../workspace/detail-page/detail-page.tsx | 26 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx b/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx index 30209483ea..4532be429c 100644 --- a/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx +++ b/packages/frontend/core/src/components/affine/page-history-modal/history-modal.tsx @@ -79,7 +79,7 @@ const ModalContainer = ({ withoutCloseButton contentOptions={contentOptions} > - {children} + {children} ); }; @@ -138,12 +138,14 @@ const HistoryEditorPreview = ({ {snapshotPage ? ( - + + + ) : (
diff --git a/packages/frontend/core/src/pages/workspace/detail-page/detail-page.tsx b/packages/frontend/core/src/pages/workspace/detail-page/detail-page.tsx index 74b7e77c62..72e064940c 100644 --- a/packages/frontend/core/src/pages/workspace/detail-page/detail-page.tsx +++ b/packages/frontend/core/src/pages/workspace/detail-page/detail-page.tsx @@ -177,14 +177,17 @@ const DetailPageImpl = memo(function DetailPageImpl({ page }: { page: Page }) { } main={ -
- - -
+ // Add a key to force rerender when page changed, to avoid error boundary persisting. + +
+ + +
+
} footer={isInTrash ? : 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 ( - - {pageId ? : null} - - ); + return pageId ? : null; };