import React from 'react' import { AlertTriangle, RotateCcw } from 'lucide-react' export class ErrorBoundary extends React.Component { constructor(props) { super(props) this.state = { hasError: false, error: null } } static getDerivedStateFromError(error) { return { hasError: true, error } } componentDidCatch(error, errorInfo) { console.error('ErrorBoundary caught an error:', error, errorInfo) } handleReset = () => { this.setState({ hasError: false, error: null }) if (this.props.onReset) { this.props.onReset() } } render() { if (this.state.hasError) { return (

Something went wrong in the form builder

{this.state.error?.message || 'An unexpected rendering error occurred.'}

) } return this.props.children } } export default ErrorBoundary