fix: end combat failing when character sync enabled
Character writeback in endEncounter wrote to a bare campaigns/{id} path,
which the firebase adapter passes straight to the SDK — the update hit a
nonexistent top-level doc, threw, and aborted the whole end-combat action
(round never reset, combat stayed running).
- endEncounter now uses ctx.campaignPath (full artifacts/... path from
App.js), falling back to the bare path for server/test adapters
- writeback failures no longer block ending combat
- regression tests: campaignPath routing, writeback-failure resilience,
and participants never cleared on end
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
23aa99ba0a
commit
ea17c5e26e
3 files changed
+62
-4
No files matched your search
+2
-1
@@ -2281,8 +2281,9 @@ function InitiativeControls({ campaignId, encounter, encounterPath }) {
|
||||
try {
|
||||
const ctx = { ...buildCtx(encounterPath), campaignId };
|
||||
if (campaignId) {
|
||||
ctx.campaignPath = getPath.campaign(campaignId);
|
||||
try {
|
||||
ctx.campaign = await storage.getDoc(getPath.campaign(campaignId));
|
||||
ctx.campaign = await storage.getDoc(ctx.campaignPath);
|
||||
} catch {}
|
||||
}
|
||||
await endEncounter(encounter, ctx);
|
||||
|
||||
Reference in new issue
Block a user