There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix(core): adjust error boundary level (#5493)
Peng Xiao444de6d4ac82
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.tsxindex 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 = ({withoutCloseButtoncontentOptions={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} />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.tsxindex 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={- <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;};