Files
waggle-os/apps/web/src/app-entry.tsx
Oleg Maslov b20b138fe4 moving
2026-09-02 10:14:22 +02:00

24 lines
838 B
TypeScript

import { createRoot } from 'react-dom/client';
import { flushSync } from 'react-dom';
import App from './App.tsx';
import './index.css';
import { applyStoredThemeEarly } from '@/providers/ThemeProvider';
export function mountApp(): void {
// Apply the persisted theme before first paint to avoid a flash of the wrong
// theme (warm graphite/dark default; warm paper for light).
applyStoredThemeEarly();
const rootElement = document.getElementById('root');
if (!rootElement) throw new Error('Waggle root element is missing');
flushSync(() => {
createRoot(rootElement).render(<App />);
});
rootElement.dataset.waggleUiReady = 'ready';
// Initialize PostHog cloud analytics (DAY0-04). Keep it off the startup path.
void import('@/lib/posthog')
.then(({ initPostHog }) => initPostHog())
.catch(() => {});
}