diff --git a/src/services/worldStateService.ts b/src/services/worldStateService.ts index 747f5ec1..6eb9482d 100644 --- a/src/services/worldStateService.ts +++ b/src/services/worldStateService.ts @@ -1493,6 +1493,8 @@ const nightwaveTagToSeason: Record = { RadioLegionSyndicate: 0 // The Wolf of Saturn Six }; +type AnyObj = { [key: string]: object | Array | string | number | boolean }; +const staticWorldStateBackup: AnyObj = structuredClone(staticWorldState); let syncWorldStateTimer: NodeJS.Timeout | null = null; export const syncWorldState = async (): Promise => { @@ -1528,7 +1530,6 @@ export const syncWorldState = async (): Promise => { logger.error("Invalid world state sync response", { data }); return; } - type AnyObj = { [key: string]: object | Array | string | number | boolean }; const staticWorldState_ = staticWorldState as AnyObj; const data_ = data as AnyObj; @@ -1547,9 +1548,9 @@ export const syncWorldState = async (): Promise => { case "Events": { const remoteValue = data_[name] as Array; - const localValue = staticWorldState_[name] as Array; + const localValue = staticWorldStateBackup[name] as Array; if (Array.isArray(remoteValue) && Array.isArray(localValue)) { - localValue.push(...remoteValue); + staticWorldState_[name] = localValue.concat(remoteValue); } } break;