2026-05-07 20:15:30 -04:00
|
|
|
import { StrictMode } from 'react'
|
|
|
|
|
import { createRoot } from 'react-dom/client'
|
|
|
|
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
|
|
|
import { BrowserRouter } from 'react-router-dom'
|
|
|
|
|
import ErrorBoundary from './components/ErrorBoundary'
|
2026-05-08 19:53:21 -04:00
|
|
|
import { ThemeProvider } from './hooks/useTheme'
|
2026-05-13 18:10:38 -04:00
|
|
|
import { SSEProvider } from './contexts/SSEContext'
|
2026-05-07 20:15:30 -04:00
|
|
|
import './index.css'
|
|
|
|
|
import App from './App'
|
|
|
|
|
|
|
|
|
|
const queryClient = new QueryClient({
|
|
|
|
|
defaultOptions: {
|
|
|
|
|
queries: {
|
2026-05-13 18:10:38 -04:00
|
|
|
// No polling — real-time updates come through SSE.
|
|
|
|
|
// staleTime is kept high; data is pushed, not pulled.
|
|
|
|
|
staleTime: 60_000,
|
2026-05-07 20:15:30 -04:00
|
|
|
refetchOnWindowFocus: false,
|
|
|
|
|
retry: 1,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
createRoot(document.getElementById('root')!).render(
|
|
|
|
|
<StrictMode>
|
|
|
|
|
<ErrorBoundary>
|
2026-05-08 19:53:21 -04:00
|
|
|
<ThemeProvider>
|
|
|
|
|
<QueryClientProvider client={queryClient}>
|
2026-05-13 18:10:38 -04:00
|
|
|
{/* SSEProvider must live inside QueryClientProvider so it can call
|
|
|
|
|
useQueryClient() to invalidate caches on incoming events. */}
|
|
|
|
|
<SSEProvider>
|
|
|
|
|
<BrowserRouter>
|
|
|
|
|
<App />
|
|
|
|
|
</BrowserRouter>
|
|
|
|
|
</SSEProvider>
|
2026-05-08 19:53:21 -04:00
|
|
|
</QueryClientProvider>
|
|
|
|
|
</ThemeProvider>
|
2026-05-07 20:15:30 -04:00
|
|
|
</ErrorBoundary>
|
|
|
|
|
</StrictMode>,
|
|
|
|
|
)
|