Skip to content

Commit 31cbba8

Browse files
Rethrow error from ErrorFallback (#82)
When this Spark is being edited in development, rethrow the error for it to be caught by the parent container. In deployed sparks, the error boundary will be shown.
1 parent b0911b3 commit 31cbba8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/ErrorFallback.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { Button } from "./components/ui/button";
44
import { AlertTriangleIcon, RefreshCwIcon } from "lucide-react";
55

66
export const ErrorFallback = ({ error, resetErrorBoundary }) => {
7+
// When encountering an error in the development mode, rethrow it and don't display the boundary.
8+
// The parent UI will take care of showing a more helpful dialog.
9+
if (import.meta.env.DEV) throw error;
10+
711
return (
812
<div className="min-h-screen bg-background flex items-center justify-center p-4">
913
<div className="w-full max-w-md">
@@ -33,4 +37,4 @@ export const ErrorFallback = ({ error, resetErrorBoundary }) => {
3337
</div>
3438
</div>
3539
);
36-
}
40+
}

0 commit comments

Comments
 (0)