Browse Source

fix: add padding around error boundary Card for consistent layout

ErrorBoundary replaces Layout.Content when catching errors, so the
Card has no outer padding. Wrap in a div with padding: 24 to match
the ProLayout content area spacing.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
pull/11756/head
afc163 5 months ago
parent
commit
8519663594
  1. 72
      src/components/ErrorBoundary/index.tsx

72
src/components/ErrorBoundary/index.tsx

@ -27,40 +27,44 @@ function renderErrorFallback(
const isChunkError = isChunkLoadError(error); const isChunkError = isChunkLoadError(error);
return ( return (
<Card variant="borderless"> <div style={{ padding: 24 }}>
<Result <Card variant="borderless">
status="error" <Result
title={intl.formatMessage({ status="error"
id: isChunkError ? 'app.error.chunk.title' : 'app.error.render.title', title={intl.formatMessage({
defaultMessage: isChunkError id: isChunkError
? 'Failed to load page' ? 'app.error.chunk.title'
: 'Something went wrong', : 'app.error.render.title',
})} defaultMessage: isChunkError
subTitle={intl.formatMessage({ ? 'Failed to load page'
id: getSubTitleId(isChunkError, isOffline), : 'Something went wrong',
defaultMessage: })}
isChunkError && isOffline subTitle={intl.formatMessage({
? 'Your network connection has been lost. Please check your connection and refresh.' id: getSubTitleId(isChunkError, isOffline),
: isChunkError defaultMessage:
? 'Page resources failed to load. Please refresh and try again.' isChunkError && isOffline
: 'Sorry, an error occurred on this page. Please refresh or go back to the home page.', ? 'Your network connection has been lost. Please check your connection and refresh.'
})} : isChunkError
extra={[ ? 'Page resources failed to load. Please refresh and try again.'
<Button type="primary" key="retry" onClick={onRetry}> : 'Sorry, an error occurred on this page. Please refresh or go back to the home page.',
{intl.formatMessage({ })}
id: 'app.error.retry', extra={[
defaultMessage: 'Refresh', <Button type="primary" key="retry" onClick={onRetry}>
})} {intl.formatMessage({
</Button>, id: 'app.error.retry',
<Button href="/" key="home"> defaultMessage: 'Refresh',
{intl.formatMessage({ })}
id: 'app.error.home', </Button>,
defaultMessage: 'Back Home', <Button href="/" key="home">
})} {intl.formatMessage({
</Button>, id: 'app.error.home',
]} defaultMessage: 'Back Home',
/> })}
</Card> </Button>,
]}
/>
</Card>
</div>
); );
} }

Loading…
Cancel
Save