Skip to content

Commit a8bc2f8

Browse files
authored
Merge pull request #7 from GitLiveApp/dynamic-target-collection-path
Fix dynamic target collection path params bug
2 parents b9d9b05 + 129d41f commit a8bc2f8

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
@@ -76,16 +76,10 @@ export function integrifyDeleteReferences(
7676
);
7777
}
7878

79-
// Replace the context.params in the target collection
80-
const paramSwap = replaceReferencesWith(
81-
context.params,
82-
target.collection
83-
);
84-
85-
// Replace the snapshot fields in the target collection
79+
// Replace the context.params and snapshot fields in the target collection
8680
const fieldSwap = replaceReferencesWith(
87-
snap.data(),
88-
paramSwap.targetCollection
81+
{ ...snap.data(), ...context.params },
82+
target.collection
8983
);
9084
target.collection = fieldSwap.targetCollection;
9185

test/unit.test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ async function testDeleteSnapshotFieldReferences(sut, t, name) {
384384
await wrapped(snap, {
385385
params: {
386386
anotherId: anotherId,
387-
testId: testId,
388387
},
389388
});
390389

0 commit comments

Comments
 (0)