mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
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.
This commit is contained in:
1 parent
84f950ade4
commit
88643d366d
1 file changed
+7
-3
@@ -90,15 +90,19 @@ function Content() {
|
|||||||
session.tracking && tankStatsB
|
session.tracking && tankStatsB
|
||||||
? deltaTankStats(session.player.stats, tankStatsB)
|
? deltaTankStats(session.player.stats, tankStatsB)
|
||||||
.sort((a, b) => b.last_battle_time - a.last_battle_time)
|
.sort((a, b) => b.last_battle_time - a.last_battle_time)
|
||||||
.map((entry) => {
|
.flatMap((entry) => {
|
||||||
const tank = tankDefinitions.tanks[entry.tank_id];
|
const tank = tankDefinitions.tanks[entry.tank_id];
|
||||||
|
if (!tank) return [];
|
||||||
|
|
||||||
const average = averageDefinitions.averages[tank.id];
|
const average = averageDefinitions.averages[tank.id];
|
||||||
|
if (!average?.mu) return [];
|
||||||
|
|
||||||
const composite = compositeStats(
|
const composite = compositeStats(
|
||||||
{ ...entry.all, battle_life_time: entry.battle_life_time },
|
{ ...entry.all, battle_life_time: entry.battle_life_time },
|
||||||
average?.mu!,
|
average.mu,
|
||||||
);
|
);
|
||||||
|
|
||||||
return { tank, composite };
|
return [{ tank, composite }];
|
||||||
})
|
})
|
||||||
: undefined,
|
: undefined,
|
||||||
[session.tracking && session.player, tankStatsB],
|
[session.tracking && session.player, tankStatsB],
|
||||||
|
|||||||
Reference in new issue
Block a user