Skip to content

Commit 129d41f

Browse files
fix(deleteReferences): Bug with missing params
1 parent e383701 commit 129d41f

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

src/rules/deleteReferences.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,10 @@ export function integrifyDeleteReferences(
6868
}] matches [${primaryKeyValue}]`
6969
);
7070

71-
// Replace the context.params in the target collection
72-
const paramSwap = replaceReferencesWith(
73-
context.params,
74-
target.collection
75-
);
76-
77-
// Replace the snapshot fields in the target collection
71+
// Replace the context.params and snapshot fields in the target collection
7872
const fieldSwap = replaceReferencesWith(
79-
snap.data(),
80-
paramSwap.targetCollection
73+
{ ...snap.data(), ...context.params },
74+
target.collection
8175
);
8276
target.collection = fieldSwap.targetCollection;
8377

test/unit.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@ async function testDeleteSnapshotFieldReferences(sut, t, name) {
378378
await wrapped(snap, {
379379
params: {
380380
anotherId: anotherId,
381-
testId: testId,
382381
},
383382
});
384383

0 commit comments

Comments
 (0)