From d96d3a6cf2faec0b1bba22022ddfaa69b3a577d2 Mon Sep 17 00:00:00 2001 From: robert Date: Sat, 27 Jun 2026 17:19:52 -0400 Subject: [PATCH] Guard against undefined values in combat log undo payloads Firestore rejects writes containing undefined values. The pause/resume and end-combat undo snapshots read encounter fields that may not yet exist in Firestore, so add ?? false / ?? null / ?? 0 fallbacks to match the pattern already used in the start-combat undo path. Co-Authored-By: Claude Sonnet 4.6 --- src/App.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/App.js b/src/App.js index 9a8e0bb..cc435aa 100644 --- a/src/App.js +++ b/src/App.js @@ -1692,7 +1692,7 @@ function InitiativeControls({ campaignId, encounter, encounterPath }) { logAction(`Combat ${newPausedState ? 'paused' : 'resumed'}: "${encounter.name}"`, { encounterName: encounter.name }, { encounterPath, updates: { - isPaused: encounter.isPaused, + isPaused: encounter.isPaused ?? false, turnOrderIds: [...(encounter.turnOrderIds || [])], }, }); @@ -1789,10 +1789,10 @@ function InitiativeControls({ campaignId, encounter, encounterPath }) { logAction(`Combat ended: "${encounter.name}"`, { encounterName: encounter.name }, { encounterPath, updates: { - isStarted: encounter.isStarted, - isPaused: encounter.isPaused, - round: encounter.round, - currentTurnParticipantId: encounter.currentTurnParticipantId, + isStarted: encounter.isStarted ?? false, + isPaused: encounter.isPaused ?? false, + round: encounter.round ?? 0, + currentTurnParticipantId: encounter.currentTurnParticipantId ?? null, turnOrderIds: [...(encounter.turnOrderIds || [])], }, });