import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.jsx'
import { ToastProvider } from './components/Toast.jsx'
import { migrateFromLocalStorage } from './lib/migrate.js'

// Fire-and-forget: migrate any localStorage leads to the DB on first load.
// Runs silently in the background and is safe if the server isn't up yet.
migrateFromLocalStorage().catch(console.warn);

createRoot(document.getElementById('root')).render(
  <StrictMode>
    <ToastProvider>
      <App />
    </ToastProvider>
  </StrictMode>,
)
