mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
fix(core): implement editor timeout and report error from boundary (#5105) ci: add sentry env when frontend assets build (#5131) fix(core): expose catched editor load error (#5133) fix(infra): use blocksuite api to check compatibility (#5137) fix(infra): compatibility logic follow blocksuite (#5143) fix(core): rerender error boundary when route change and improve sentry report (#5147)
This commit is contained in:
@@ -113,7 +113,6 @@ export const DetailPage = (): ReactElement => {
|
||||
const currentSyncEngineStatus = useCurrentSyncEngineStatus();
|
||||
const currentPageId = useAtomValue(currentPageIdAtom);
|
||||
const [page, setPage] = useState<Page | null>(null);
|
||||
const [pageLoaded, setPageLoaded] = useState<boolean>(false);
|
||||
|
||||
// load page by current page id
|
||||
useEffect(() => {
|
||||
@@ -158,30 +157,7 @@ export const DetailPage = (): ReactElement => {
|
||||
return;
|
||||
}, [currentSyncEngineStatus, navigate, page]);
|
||||
|
||||
// wait for page to be loaded
|
||||
useEffect(() => {
|
||||
if (page) {
|
||||
if (!page.isEmpty) {
|
||||
setPageLoaded(true);
|
||||
} else {
|
||||
setPageLoaded(false);
|
||||
// call waitForLoaded to trigger load
|
||||
page
|
||||
.load(() => {})
|
||||
.catch(() => {
|
||||
// do nothing
|
||||
});
|
||||
return page.slots.ready.on(() => {
|
||||
setPageLoaded(true);
|
||||
}).dispose;
|
||||
}
|
||||
} else {
|
||||
setPageLoaded(false);
|
||||
}
|
||||
return;
|
||||
}, [page]);
|
||||
|
||||
if (!currentPageId || !page || !pageLoaded) {
|
||||
if (!currentPageId || !page) {
|
||||
return <PageDetailSkeleton key="current-page-is-null" />;
|
||||
}
|
||||
|
||||
@@ -218,8 +194,9 @@ export const Component = () => {
|
||||
}
|
||||
}, [params, setContentLayout, setCurrentPageId, setCurrentWorkspaceId]);
|
||||
|
||||
// Add a key to force rerender when page changed, to avoid error boundary persisting.
|
||||
return (
|
||||
<AffineErrorBoundary>
|
||||
<AffineErrorBoundary key={params.pageId}>
|
||||
<DetailPage />
|
||||
</AffineErrorBoundary>
|
||||
);
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
import type { MigrationPoint } from '@toeverything/infra/blocksuite';
|
||||
import {
|
||||
checkWorkspaceCompatibility,
|
||||
fixWorkspaceVersion,
|
||||
guidCompatibilityFix,
|
||||
} from '@toeverything/infra/blocksuite';
|
||||
import { useSetAtom } from 'jotai';
|
||||
@@ -54,6 +55,7 @@ export const loader: LoaderFunction = async args => {
|
||||
workspaceLoaderLogger.info('workspace loaded');
|
||||
|
||||
guidCompatibilityFix(workspace.doc);
|
||||
fixWorkspaceVersion(workspace.doc);
|
||||
return checkWorkspaceCompatibility(workspace);
|
||||
};
|
||||
|
||||
@@ -73,7 +75,7 @@ export const Component = (): ReactElement => {
|
||||
|
||||
const migration = useLoaderData() as MigrationPoint | undefined;
|
||||
return (
|
||||
<AffineErrorBoundary height="100vh">
|
||||
<AffineErrorBoundary key={params.workspaceId} height="100vh">
|
||||
<WorkspaceLayout migration={migration}>
|
||||
<Outlet />
|
||||
</WorkspaceLayout>
|
||||
|
||||
Reference in New Issue
Block a user