diff --git a/packages/frontend/core/src/components/affine/affine-error-boundary.css.ts b/packages/frontend/core/src/components/affine/affine-error-boundary.css.ts index 145b0c6aec..5999d7ec1c 100644 --- a/packages/frontend/core/src/components/affine/affine-error-boundary.css.ts +++ b/packages/frontend/core/src/components/affine/affine-error-boundary.css.ts @@ -15,7 +15,7 @@ export const errorDetailStyle = style({ }); export const errorTitle = style({ - fontSize: '36px', + fontSize: '32px', lineHeight: '44px', fontWeight: 700, }); diff --git a/packages/frontend/core/src/components/affine/affine-error-boundary.tsx b/packages/frontend/core/src/components/affine/affine-error-boundary.tsx index 648e5f1e00..cd576a0ec2 100644 --- a/packages/frontend/core/src/components/affine/affine-error-boundary.tsx +++ b/packages/frontend/core/src/components/affine/affine-error-boundary.tsx @@ -20,7 +20,7 @@ import { useLocation, useParams } from 'react-router-dom'; import { RecoverableError, - SessionFetchErrorRightAfterLoginOrSignUp, + type SessionFetchErrorRightAfterLoginOrSignUp, } from '../../unexpected-application-state/errors'; import { errorDescription, @@ -33,7 +33,9 @@ import { } from './affine-error-boundary.css'; import errorBackground from './error-status.assets.svg'; -export type AffineErrorBoundaryProps = React.PropsWithChildren; +export type AffineErrorBoundaryProps = React.PropsWithChildren & { + height?: number | string; +}; type AffineError = | QueryParamError @@ -81,7 +83,7 @@ export class AffineErrorBoundary extends Component< if (this.state.error.canRetry()) { this.state.error.retry(); this.setState({ - error: this.state.error, + error: null, canRetryRecoveredError: this.state.error.canRetry(), }); } else { @@ -90,6 +92,10 @@ export class AffineErrorBoundary extends Component< } }; + private readonly handleRefresh = () => { + this.setState({ error: null }); + }; + static getDerivedStateFromError( error: AffineError ): AffineErrorBoundaryState { @@ -121,14 +127,14 @@ export class AffineErrorBoundary extends Component< ); - } else if (error instanceof SessionFetchErrorRightAfterLoginOrSignUp) { + } else if (error instanceof RecoverableError) { const retryButtonDesc = this.state.canRetryRecoveredError ? 'Refetch' : 'Reload'; errorDetail = ( <>

Sorry.. there was an error

- Fetching session failed + {error.message} If you are still experiencing this issue, please{' '} -

Sorry.. there was an error

- {error.message ?? error.toString()} +

Sorry.. there was an error

+ + {error.message ?? error.toString()} + + ); } return ( -
+
{errorDetail}
{ getSession() .then(session => { diff --git a/packages/frontend/core/src/pages/workspace/index.tsx b/packages/frontend/core/src/pages/workspace/index.tsx index 056f9acc84..c2283c7c77 100644 --- a/packages/frontend/core/src/pages/workspace/index.tsx +++ b/packages/frontend/core/src/pages/workspace/index.tsx @@ -17,6 +17,7 @@ import { useParams, } from 'react-router-dom'; +import { AffineErrorBoundary } from '../../components/affine/affine-error-boundary'; import { WorkspaceLayout } from '../../layouts/workspace-layout'; import { performanceLogger, performanceRenderLogger } from '../../shared'; @@ -82,8 +83,10 @@ export const Component = (): ReactElement => { const incompatible = useLoaderData(); return ( - - - + + + + + ); };