Skip to content

Commit 79a2306

Browse files
committed
applies review suggestions
1 parent 5ae8370 commit 79a2306

File tree

6 files changed

+9
-5
lines changed

6 files changed

+9
-5
lines changed

pages/error-boundary/error-boundary-fallbacks.page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ console.error = () => {};
2424

2525
export default function () {
2626
return (
27-
<SimplePage title="Error boundary fallbacks" i18n={{}}>
27+
<SimplePage title="Error boundary fallbacks" i18n={{}} screenshotArea={{}}>
2828
<SpaceBetween size="l">
2929
<Section title="Default">
3030
<Example code="{}" />

src/__tests__/snapshot-tests/__snapshots__/design-tokens.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`Design tokens artifacts Design tokens JSON for classic matches the snapshot: classic 1`] = `
44
{

src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11492,7 +11492,7 @@ case, any error originating from the error boundary content will be captured by
1149211492
],
1149311493
"regions": [
1149411494
{
11495-
"description": "Content, rendered when no error is captured.",
11495+
"description": "Content rendered when no error is captured.",
1149611496
"isDefault": true,
1149711497
"name": "children",
1149811498
},

src/container/internal.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ export default function InternalContainer({
156156
key={__contentKey}
157157
className={clsx(styles['content-wrapper'], fitHeight && styles['content-wrapper-fit-height'])}
158158
>
159+
{/* We use a wrapper around the boundary to preserve container's paddings. */}
159160
<BuiltInErrorBoundary wrapper={content => <InternalBox padding="m">{content}</InternalBox>}>
160161
{header && (
161162
<ContainerHeaderContextProvider>
@@ -197,6 +198,9 @@ export default function InternalContainer({
197198
})}
198199
style={getContentStyles(style)}
199200
>
201+
{/* We use a wrapper around the boundary to preserve paddings in case they were disabled by the consumer.
202+
That is needed because the consumer-defined paddings that normally come with the content can no longer
203+
apply since the content failed to render. */}
200204
<BuiltInErrorBoundary
201205
wrapper={content => (
202206
<InternalBox padding={disableContentPaddings ? 'm' : undefined}>{content}</InternalBox>

src/error-boundary/interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export interface ErrorBoundaryProps {
4949
i18nStrings?: ErrorBoundaryProps.I18nStrings;
5050

5151
/**
52-
* Content, rendered when no error is captured.
52+
* Content rendered when no error is captured.
5353
*/
5454
children: React.ReactNode;
5555
}

src/error-boundary/internal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class ErrorBoundaryImpl extends Component<ErrorBoundaryImplProps, ErrorBoundaryS
112112
}
113113

114114
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {
115-
this.props.onError?.({ error, errorInfo, errorBoundaryId: this.props.errorBoundaryId });
115+
this.props.onError({ error, errorInfo, errorBoundaryId: this.props.errorBoundaryId });
116116
}
117117

118118
render() {

0 commit comments

Comments
 (0)