Game Stats - backward compatibility (#4623)

## Description:

fixes a bug where old games under the old schema don't open correctly

main.openfront.dev:
<img width="1043" height="405" alt="image"
src="https://github.com/user-attachments/assets/d94811b9-ecfe-4243-9afb-5b25df4366f8"
/>


this branch:
<img width="1034" height="942" alt="image"
src="https://github.com/user-attachments/assets/8dcf07e6-2934-4a85-85a7-3f51a493c504"
/>


## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory

## Please put your Discord username so you can be contacted if a bug or
regression is found:

w.o.n
This commit is contained in:
Ryan
2026-07-16 15:22:20 -07:00
committed by GitHub
parent d59b5cdfd7
commit 943740de32
4 changed files with 149 additions and 3 deletions
+4 -2
View File
@@ -20,7 +20,7 @@ import {
} from "../core/ApiSchemas";
import {
AnalyticsRecord,
AnalyticsRecordSchema,
ArchivedAnalyticsRecordSchema,
GameInfo,
} from "../core/Schemas";
import { getAuthHeader, getPlayToken, logOut, userAuth } from "./Auth";
@@ -613,7 +613,9 @@ export async function fetchGameById(
}
const json = await res.json();
const parsed = AnalyticsRecordSchema.safeParse(json);
// Lenient schema: archives written by older builds predate several
// schema changes (see ArchivedAnalyticsRecordSchema).
const parsed = ArchivedAnalyticsRecordSchema.safeParse(json);
if (!parsed.success) {
console.warn("fetchGameById: Zod validation failed", parsed.error);
return false;