Skip to content

Commit

Permalink
Fix issue where sync would fail if only provided delete operations.
Browse files Browse the repository at this point in the history
  • Loading branch information
nkooman-bzs committed Jan 17, 2025
1 parent fd09508 commit 40c0f39
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modules/sync/sync/collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export const syncAddAndReplaceCollections = (
collections: DiffModel["collections"],
logOptions: LogOptions,
) => {
if (!collections.length) {
const collectionAddAndReplaceOps = collections.filter(op => op.op !== "remove");

if (!collectionAddAndReplaceOps.length) {
logInfo(logOptions, "standard", "No collections to add or update");
return Promise.resolve();
}
Expand All @@ -19,7 +21,7 @@ export const syncAddAndReplaceCollections = (

return client
.setCollections()
.withData(collections.filter(op => op.op !== "remove").map(transformCollectionsReferences))
.withData(collectionAddAndReplaceOps.map(transformCollectionsReferences))
.toPromise();
};

Expand Down

0 comments on commit 40c0f39

Please sign in to comment.