Skip to content

Commit 3009d76

Browse files
authored
Fix error throw and for useTransition demo (#6510)
1 parent 3bf64e5 commit 3009d76

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/components/MDX/Sandpack/Preview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function Preview({
5454

5555
// When throwing a new Error in Sandpack - we want to disable the dev error dialog
5656
// to show the Error Boundary fallback
57-
if (rawError && rawError.message.includes(`throw Error('Example error')`)) {
57+
if (rawError && rawError.message.includes('Example Error:')) {
5858
rawError = null;
5959
}
6060

src/content/reference/react/useTransition.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,15 +1520,15 @@ import { ErrorBoundary } from "react-error-boundary";
15201520
export function AddCommentContainer() {
15211521
return (
15221522
<ErrorBoundary fallback={<p>⚠️Something went wrong</p>}>
1523-
<AddCommentButton />
1523+
<AddCommentButton />
15241524
</ErrorBoundary>
15251525
);
15261526
}
15271527

15281528
function addComment(comment) {
15291529
// For demonstration purposes to show Error Boundary
1530-
if(comment == null){
1531-
throw Error('Example error')
1530+
if (comment == null) {
1531+
throw new Error("Example Error: An error thrown to trigger error boundary");
15321532
}
15331533
}
15341534

@@ -1544,9 +1544,10 @@ function AddCommentButton() {
15441544
// so error gets thrown
15451545
addComment();
15461546
});
1547-
}}>
1548-
Add comment
1549-
</button>
1547+
}}
1548+
>
1549+
Add comment
1550+
</button>
15501551
);
15511552
}
15521553
```

0 commit comments

Comments
 (0)