Home / Class/ ComponentErrorBoundary Class — ui Architecture

ComponentErrorBoundary Class — ui Architecture

Architecture documentation for the ComponentErrorBoundary class in component-wrapper.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  832e64fe_7e88_b588_7d07_beb335c4491b["ComponentErrorBoundary"]
  dc3130d7_85e4_d3f9_f827_dc97c3125a68["component-wrapper.tsx"]
  832e64fe_7e88_b588_7d07_beb335c4491b -->|defined in| dc3130d7_85e4_d3f9_f827_dc97c3125a68
  2edc0fcd_27ec_d7cd_98f6_2057655228e6["constructor()"]
  832e64fe_7e88_b588_7d07_beb335c4491b -->|method| 2edc0fcd_27ec_d7cd_98f6_2057655228e6
  85c59e0d_5faf_a191_49e1_9b51694e15ae["getDerivedStateFromError()"]
  832e64fe_7e88_b588_7d07_beb335c4491b -->|method| 85c59e0d_5faf_a191_49e1_9b51694e15ae
  aaae0e25_b8c8_ef55_c00c_654cbdde14cb["componentDidCatch()"]
  832e64fe_7e88_b588_7d07_beb335c4491b -->|method| aaae0e25_b8c8_ef55_c00c_654cbdde14cb
  a8a43c6d_a9af_39d4_725a_31b01090a2ec["render()"]
  832e64fe_7e88_b588_7d07_beb335c4491b -->|method| a8a43c6d_a9af_39d4_725a_31b01090a2ec

Relationship Graph

Source Code

apps/v4/app/(internal)/sink/components/component-wrapper.tsx lines 33–61

class ComponentErrorBoundary extends React.Component<
  { children: React.ReactNode; name: string },
  { hasError: boolean }
> {
  constructor(props: { children: React.ReactNode; name: string }) {
    super(props)
    this.state = { hasError: false }
  }

  static getDerivedStateFromError() {
    return { hasError: true }
  }

  componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
    console.error(`Error in component ${this.props.name}:`, error, errorInfo)
  }

  render() {
    if (this.state.hasError) {
      return (
        <div className="p-4 text-red-500">
          Something went wrong in component: {this.props.name}
        </div>
      )
    }

    return this.props.children
  }
}

Frequently Asked Questions

What is the ComponentErrorBoundary class?
ComponentErrorBoundary is a class in the ui codebase, defined in apps/v4/app/(internal)/sink/components/component-wrapper.tsx.
Where is ComponentErrorBoundary defined?
ComponentErrorBoundary is defined in apps/v4/app/(internal)/sink/components/component-wrapper.tsx at line 33.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free