import ReactDOM from 'react-dom/client'
import { BrowserRouter } from 'react-router-dom'
import { AuthProvider } from './contexts/AuthContext.jsx'
import ErrorBoundary from './components/shell/ErrorBoundary.jsx'
import App from './App.jsx'
import './App.css'

// StrictMode intentionally disabled. LiveSessionPage opens a WebSocket in
// useEffect, and StrictMode's dev-only double-mount tears the socket down
// mid-handshake (CONNECTING → close). The close handler interprets that as
// a network drop and schedules a reconnect, which then races with the second
// mount's fresh open — recording never gets past the start handshake in dev.
// The fix-it-properly path is to make the WS lifecycle imperative (mediscan-
// style `connect()` with a wsRef dedup) instead of useEffect-driven.
ReactDOM.createRoot(document.getElementById('root')).render(
  <ErrorBoundary>
    <BrowserRouter>
      <AuthProvider>
        <App />
      </AuthProvider>
    </BrowserRouter>
  </ErrorBoundary>,
)
