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 }, {
|
logAction(`Combat ${newPausedState ? 'paused' : 'resumed'}: "${encounter.name}"`, { encounterName: encounter.name }, {
|
||||||
encounterPath,
|
encounterPath,
|
||||||
updates: {
|
updates: {
|
||||||
isPaused: encounter.isPaused,
|
isPaused: encounter.isPaused ?? false,
|
||||||
turnOrderIds: [...(encounter.turnOrderIds || [])],
|
turnOrderIds: [...(encounter.turnOrderIds || [])],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -1789,10 +1789,10 @@ function InitiativeControls({ campaignId, encounter, encounterPath }) {
|
|||||||
logAction(`Combat ended: "${encounter.name}"`, { encounterName: encounter.name }, {
|
logAction(`Combat ended: "${encounter.name}"`, { encounterName: encounter.name }, {
|
||||||
encounterPath,
|
encounterPath,
|
||||||
updates: {
|
updates: {
|
||||||
isStarted: encounter.isStarted,
|
isStarted: encounter.isStarted ?? false,
|
||||||
isPaused: encounter.isPaused,
|
isPaused: encounter.isPaused ?? false,
|
||||||
round: encounter.round,
|
round: encounter.round ?? 0,
|
||||||
currentTurnParticipantId: encounter.currentTurnParticipantId,
|
currentTurnParticipantId: encounter.currentTurnParticipantId ?? null,
|
||||||
turnOrderIds: [...(encounter.turnOrderIds || [])],
|
turnOrderIds: [...(encounter.turnOrderIds || [])],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user