import React, { StrictMode, Component, ErrorInfo, ReactNode } from 'react'; import { createRoot } from 'react-dom/client'; import App from './App.tsx'; import './index.css'; interface Props { children?: ReactNode; } interface State { hasError: boolean; error: Error | null; } class ErrorBoundary extends Component { public state: State = { hasError: false, error: null }; public static getDerivedStateFromError(error: Error): State { return { hasError: true, error }; } public componentDidCatch(error: Error, errorInfo: ErrorInfo) { console.error("Uncaught error:", error, errorInfo); } public render() { if (this.state.hasError) { return (

Something went wrong.

{this.state.error?.toString()}
{this.state.error?.stack}
); } return this.props.children; } } // Unregister any existing service workers to prevent reload loops if ('serviceWorker' in navigator) { navigator.serviceWorker.getRegistrations().then((registrations) => { for (const registration of registrations) { registration.unregister(); } }).catch(err => console.error('Service Worker unregistration failed: ', err)); } createRoot(document.getElementById('root')!).render( , );