tests: BUG-4 RED locked (hide-HP clobbers activeDisplay), add write recorder
src/tests/HideHpToggle.test.js: renders App, selects campaign, toggles
hide-player-HP switch, asserts setDoc data includes activeCampaignId +
activeEncounterId. RED: data only {hidePlayerHp:true}, both clobbered.
Root cause proven with evidence (recorder):
setDoc(activeDisplay/status, {hidePlayerHp:true}, {merge:true})
data written = {hidePlayerHp:true} ONLY
activeCampaignId = undefined
activeEncounterId = undefined
setDoc = replace per contract. {merge:true} arg ignored. Toggle wipes
encounter pointer → DisplayView reads null → 'Game Session Paused'.
Fix: use updateDoc (patch), not setDoc.
src/storage/firebase.js: adapter recorder now captures setDoc + updateDoc
(data + opts). Was subscribe-only. Enables write-path assertions.
This commit is contained in:
@@ -86,10 +86,12 @@ export function createFirebaseStorage() {
|
||||
},
|
||||
|
||||
async setDoc(path, data, opts = {}) {
|
||||
recordAdapterCall({ fn: 'setDoc', path, data, opts });
|
||||
await setDoc(doc(db, path), data, opts.merge ? { merge: true } : undefined);
|
||||
},
|
||||
|
||||
async updateDoc(path, patch) {
|
||||
recordAdapterCall({ fn: 'updateDoc', path, patch });
|
||||
await updateDoc(doc(db, path), patch);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user