diff --git a/frontend/index.html b/frontend/index.html index 20f43aa..4c5dc71 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -16,6 +16,38 @@ })(); + + diff --git a/frontend/index.tsx b/frontend/index.tsx index e8709af..462a1b7 100644 --- a/frontend/index.tsx +++ b/frontend/index.tsx @@ -19,6 +19,17 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; const queryClient = new QueryClient(); +// Auto-reload em chunk obsoleto pós-deploy (par do watchdog inline no index.html). +// Timestamp evita loop: só recarrega se a última tentativa foi há mais de 30s. +window.addEventListener('vite:preloadError', () => { + try { + const last = +(sessionStorage.getItem('__sd_stale_reload__') || 0); + if (Date.now() - last < 30000) return; + sessionStorage.setItem('__sd_stale_reload__', String(Date.now())); + } catch { /* ignore */ } + window.location.reload(); +}); + const rootElement = document.getElementById('root'); if (rootElement) { const root = createRoot(rootElement);