Fix serialization/deserialization when logging session/system data

This commit is contained in:
Sirz Benjie 2025-09-07 17:23:49 -05:00
parent 3ae69dcac9
commit 47dc3c25f2
No known key found for this signature in database
GPG Key ID: 4A524B4D196C759E

View File

@ -424,7 +424,13 @@ export class GameData {
} }
if (isLocal || isBeta) { if (isLocal || isBeta) {
console.debug(JSON.parse(JSON.stringify(systemData))); try {
console.debug(
this.parseSystemData(JSON.stringify(systemData, (_, v: any) => (typeof v === "bigint" ? v.toString() : v))),
);
} catch (err) {
console.debug("Attempt to log system data failed:", err);
}
} }
localStorage.setItem(`data_${loggedInUser?.username}`, encrypt(systemDataStr, bypassLogin)); localStorage.setItem(`data_${loggedInUser?.username}`, encrypt(systemDataStr, bypassLogin));
@ -1042,7 +1048,15 @@ export class GameData {
try { try {
const initSessionFromData = (fromSession: SessionSaveData) => { const initSessionFromData = (fromSession: SessionSaveData) => {
if (isLocal || isBeta) { if (isLocal || isBeta) {
console.debug(JSON.parse(JSON.stringify(fromSession))); try {
console.debug(
this.parseSessionData(
JSON.stringify(fromSession, (_, v: any) => (typeof v === "bigint" ? v.toString() : v)),
),
);
} catch (err) {
console.debug("Attempt to log session data failed:", err);
}
} }
// overwrite slot ID if somehow not set. // overwrite slot ID if somehow not set.
fromSession.slotId = slotId; fromSession.slotId = slotId;