2import { StrictMode } from 'react'
3import { createRoot } from 'react-dom/client'
5// load the global fetch wrapper early so all components use it
7import './styles/theme.css'
8import './styles/themes.css'
9import { initTheme } from './utils/themeManager'
10import App from './App.jsx'
12// Import Quill JS and CSS from npm for Quill 2.x
14import 'quill/dist/quill.snow.css';
16// One-time cleanup: Remove quotes from corrupted tenant_id in localStorage
17// (Fix for issue where tenant_id had trailing quotes causing 500 errors)
19 const tid = localStorage.getItem('selectedTenantId');
20 if (tid && (tid.includes("'") || tid.includes('"'))) {
21 const cleaned = tid.trim().replace(/['"]/g, '');
22 localStorage.setItem('selectedTenantId', cleaned);
23 console.log('[localStorage] Cleaned corrupted tenant_id:', tid, '→', cleaned);
26 console.warn('[localStorage] Failed to clean tenant_id:', err);
29// initialize theme (reads saved settings or server)
30initTheme().finally(() => {
31 createRoot(document.getElementById('root')).render(