fix: handle stale chunk 404s + add page loading states

- Router catches failed dynamic imports and forces reload (stale deploy cache)
- LeaderboardPage: sprite-based loading animation while fetching
- ArenaPage: sprite-based loading animation while fetching

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-08 11:15:34 +00:00
co-authored by Claude Opus 4.6
parent 9a11c48487
commit 8a3480e5ab
3 changed files with 22 additions and 2 deletions
+7 -1
View File
@@ -45,8 +45,14 @@ const tierClass = (t: number) => `tier-${t}`
<div></div> <div></div>
</div> </div>
<!-- Loading -->
<div v-if="isLoading" class="flex-1 flex flex-col items-center justify-center gap-4">
<SpritePreview seed="loading" archetype="blob" :size="80" class="animate-bounce" />
<p class="font-display text-sm text-text-muted animate-pulse tracking-widest">LOADING FIGHTS...</p>
</div>
<!-- Fight cards --> <!-- Fight cards -->
<div class="flex-1 min-h-0 overflow-y-auto space-y-3"> <div v-else class="flex-1 min-h-0 overflow-y-auto space-y-3">
<RouterLink <RouterLink
v-for="fight in fights" v-for="fight in fights"
:key="fight.id" :key="fight.id"
+7 -1
View File
@@ -52,8 +52,14 @@ const record = (b: Bot) => `${b.wins}W - ${b.losses}L`
</span> </span>
</div> </div>
<!-- Loading -->
<div v-if="isLoading" class="flex-1 flex flex-col items-center justify-center gap-4">
<SpritePreview seed="loading" archetype="standard" :size="80" class="animate-bounce" />
<p class="font-display text-sm text-text-muted animate-pulse tracking-widest">LOADING FIGHTERS...</p>
</div>
<!-- Table --> <!-- Table -->
<div class="flex-1 min-h-0 overflow-y-auto border border-border rounded-lg bg-surface-raised/50"> <div v-else class="flex-1 min-h-0 overflow-y-auto border border-border rounded-lg bg-surface-raised/50">
<table class="w-full"> <table class="w-full">
<thead class="sticky top-0 bg-surface-raised z-10"> <thead class="sticky top-0 bg-surface-raised z-10">
<tr class="border-b border-border text-text-muted font-display text-[10px] uppercase tracking-[0.15em]"> <tr class="border-b border-border text-text-muted font-display text-[10px] uppercase tracking-[0.15em]">
+8
View File
@@ -67,3 +67,11 @@ export const router = createRouter({
history: createWebHistory(), history: createWebHistory(),
routes, routes,
}) })
// Handle stale chunk 404s after deploy — force reload to get new assets
router.onError((err, to) => {
if (err.message.includes('Failed to fetch dynamically imported module') ||
err.message.includes('Importing a module script failed')) {
window.location.assign(to.fullPath)
}
})