From 88643d366d79ccb641d7c7942777f2be15cabbeb Mon Sep 17 00:00:00 2001 From: Mark Greene Date: Wed, 23 Sep 2026 08:21:16 +1200 Subject: [PATCH 1/2] Fix: skip session delta entries with no tank definition or average The /session/ page crashed when a tracked player's tank stats included a tank with no matching tank definition or no average stats (WN8 baseline). The delta memo dereferenced `tank.id` on a possibly missing definition and forced `average?.mu!` through as non-null, so a missing average threw inside `compositeStats`/`calculateWN8` uncaught, breaking the page on every load while the bad state persisted in localStorage. Skip those entries instead of crashing: entries with no tank definition or no average `mu` are dropped from the delta via `flatMap`, so the rest of the session table still renders. --- .../[...chunk_default]/[...locale]/session/_index.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/session/_index.tsx b/packages/website/src/pages/[...chunk_default]/[...locale]/session/_index.tsx index 5706a3ace..5625af9e7 100644 --- a/packages/website/src/pages/[...chunk_default]/[...locale]/session/_index.tsx +++ b/packages/website/src/pages/[...chunk_default]/[...locale]/session/_index.tsx @@ -90,15 +90,19 @@ function Content() { session.tracking && tankStatsB ? deltaTankStats(session.player.stats, tankStatsB) .sort((a, b) => b.last_battle_time - a.last_battle_time) - .map((entry) => { + .flatMap((entry) => { const tank = tankDefinitions.tanks[entry.tank_id]; + if (!tank) return []; + const average = averageDefinitions.averages[tank.id]; + if (!average?.mu) return []; + const composite = compositeStats( { ...entry.all, battle_life_time: entry.battle_life_time }, - average?.mu!, + average.mu, ); - return { tank, composite }; + return [{ tank, composite }]; }) : undefined, [session.tracking && session.player, tankStatsB], From f7ca622906026ad8afa571ae953a690895378963 Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Thu, 24 Sep 2026 16:07:12 -0500 Subject: [PATCH 2/2] correct assertions --- .../[...chunk_default]/[...locale]/session/_index.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/website/src/pages/[...chunk_default]/[...locale]/session/_index.tsx b/packages/website/src/pages/[...chunk_default]/[...locale]/session/_index.tsx index 5625af9e7..28fbf6529 100644 --- a/packages/website/src/pages/[...chunk_default]/[...locale]/session/_index.tsx +++ b/packages/website/src/pages/[...chunk_default]/[...locale]/session/_index.tsx @@ -91,15 +91,17 @@ function Content() { ? deltaTankStats(session.player.stats, tankStatsB) .sort((a, b) => b.last_battle_time - a.last_battle_time) .flatMap((entry) => { + if (!(entry.tank_id in tankDefinitions.tanks)) return []; + const tank = tankDefinitions.tanks[entry.tank_id]; - if (!tank) return []; + + if (!(tank.id in averageDefinitions.averages)) return []; const average = averageDefinitions.averages[tank.id]; - if (!average?.mu) return []; const composite = compositeStats( { ...entry.all, battle_life_time: entry.battle_life_time }, - average.mu, + average.mu!, ); return [{ tank, composite }];