SPB Git

Repository Public

main.tsx 1.2 KB 19 lines tsx

1import { QueryClient, QueryClientProvider } from '@tanstack/react-query';2import { StrictMode } from 'react';3import { createRoot } from 'react-dom/client';4import { App } from './App';5import { applyTheme } from './theme';6import './styles.css';78const qc = new QueryClient({ defaultOptions: { queries: { retry: 1, refetchOnWindowFocus: true, staleTime: 5000, gcTime: 0 } } });9// Development only: `?mock=1` simulates the derivatives API in the browser (recorded fixtures, no backend). `import.meta.env.DEV`10// is the constant `false` in a production build, so this block and the mock module are removed from the bundle.11if (import.meta.env.DEV) {12  const q = new URLSearchParams(location.search);13  if (q.get('mock') === '1') sessionStorage.setItem('spw-mock', q.get('empty') === '1' ? 'empty' : '1');14  else if (q.get('mock') === '0') sessionStorage.removeItem('spw-mock');15  if (sessionStorage.getItem('spw-mock') !== null) (await import('./derivatives/mock')).installMock();16}17applyTheme(localStorage.getItem('spw-theme') === 'dark' ? 'dark' : 'light'); // light by default18createRoot(document.getElementById('root')!).render(<StrictMode><QueryClientProvider client={qc}><App /></QueryClientProvider></StrictMode>);19
Files main
Menu

Theme