diff --git a/components/AIAssist.tsx b/components/AIAssist.tsx index c1137aa..f1f9d02 100644 --- a/components/AIAssist.tsx +++ b/components/AIAssist.tsx @@ -34,6 +34,37 @@ interface PreviewData { * A ultra-stable iframe wrapper that avoids hydration issues * and provides a WOW visual experience. */ + +// Error Boundary for Canvas crashes +class CanvasErrorBoundary extends React.Component<{ children: React.ReactNode }, { hasError: boolean, error: string | null }> { + constructor(props: { children: React.ReactNode }) { + super(props); + this.state = { hasError: false, error: null }; + } + + static getDerivedStateFromError(error: Error) { + return { hasError: true, error: error.message }; + } + + render() { + if (this.state.hasError) { + return ( +
{this.state.error}
+ +