feat(admin): reload once when a chunk fails to load after a deploy (quick-261028-rqb)

- installChunkReloadGuard reloads on vite:preloadError, at most once per
  60 s through a sessionStorage timestamp; no storage means no reload
This commit is contained in:
Jakub Zych
2026-10-28 21:21:28 +01:00
parent 291b18fb1e
commit 64452a4919
3 changed files with 68 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ import App from './App.vue'
import { createAdminRouter } from './app/router'
import { onUnauthorized } from './api/client'
import { startBuildWatch } from './app/buildUpdate'
import { installChunkReloadGuard } from './app/chunkReload'
import { loadFieldTypes } from './app/fieldTypes'
import { loadStrings } from './app/i18n'
import { expireSession, me } from './state/useAuth'
@@ -12,6 +13,8 @@ import { loadSettings } from './state/useSettings'
import './styles/main.css'
async function boot(): Promise<void> {
// A chunk that fails to load after a deploy reloads the page once.
installChunkReloadGuard()
// The last theme choice (system unless the admin picked light or dark) is
// applied before the first await, so nothing renders in the wrong theme;
// me() then applies the admin's stored preference.