"use client"; import React, { Component, ReactNode } from "react"; interface Props { children: ReactNode; fallback?: ReactNode; } interface State { hasError: boolean; error?: Error; } export class NotificationErrorBoundary extends Component { constructor(props: Props) { super(props); this.state = { hasError: false }; } static getDerivedStateFromError(error: Error): State { // Update state so the next render will show the fallback UI return { hasError: true, error }; } componentDidCatch(error: Error, errorInfo: React.ErrorInfo) { console.error("🚨 [NotificationErrorBoundary] Caught error:", error, errorInfo); } render() { if (this.state.hasError) { return ( this.props.fallback || (

Something went wrong with notifications.

) ); } return this.props.children; } }