"use client"; import { Component, type ErrorInfo, type ReactNode } from "react"; type Props = { children: ReactNode; }; type State = { error: Error | null; }; export class ChatErrorBoundary extends Component { state: State = { error: null }; static getDerivedStateFromError(error: Error): State { return { error }; } componentDidCatch(error: Error, info: ErrorInfo) { console.warn("chat render crash", error, info); } render() { if (this.state.error) { return (
The conversation failed to render. Reload to recover.
); } return this.props.children; } }