We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ff77f56 commit 3de8f91Copy full SHA for 3de8f91
src/Spline.tsx
@@ -49,6 +49,12 @@ const Spline = forwardRef<HTMLDivElement, SplineProps>(
49
) => {
50
const canvasRef = useRef<HTMLCanvasElement>(null);
51
const [isLoading, setIsLoading] = useState(true);
52
+ const [error, setError] = useState<Error>();
53
+
54
+ // We throw the error so ErrorBoundary can catch it
55
+ if (error) {
56
+ throw error;
57
+ }
58
59
// Initialize runtime when component is mounted
60
useEffect(() => {
@@ -113,7 +119,9 @@ const Spline = forwardRef<HTMLDivElement, SplineProps>(
113
119
onLoad?.(speApp);
114
120
}
115
121
116
- init();
122
+ init().catch((err) => {
123
+ setError(err as Error);
124
+ });
117
125
118
126
127
return () => {
0 commit comments