// PaneBoundary — ErrorBoundary scoped to one Shell pane. A crash in // the Conversation component shouldn't black-out the whole window; it // should leave NavBar + List + StatusBar usable so the operator can // switch sections and report the bug. Resets when the keyed section // changes. import React from 'react'; interface Props { /** Used as React key at the callsite; also shown in the panic copy. */ sectionName: string; children: React.ReactNode; } interface State { error: Error | null; } export class PaneBoundary extends React.Component { state: State = { error: null }; static getDerivedStateFromError(error: Error): State { return { error }; } componentDidCatch(error: Error, info: React.ErrorInfo): void { console.error(`[PaneBoundary:${this.props.sectionName}]`, error, info); } render(): React.ReactNode { if (!this.state.error) return this.props.children; return (
{this.props.sectionName} crashed
{this.state.error.message}
          {this.state.error.stack}
        
); } }