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 <noreply@anthropic.com>
This commit is contained in:
+5
-5
@@ -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 || [])],
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user