Skip to content

Commit 91a4dda

Browse files
committed
fix: undefined difference function
1 parent da5233c commit 91a4dda

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/client/ground.db.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,13 @@ Ground.Collection = class GroundCollection {
343343
// Map each cursor id's into one flat array
344344
const keepIds = arrayOfCursors.map((cursor) => cursor.map((doc) => strId(doc._id))).flat();
345345
// Remove all other documents from the collection
346-
difference(currentIds, keepIds).forEach((id) => {
346+
const arrays = [currentIds, keepIds];
347+
for (const id of arrays.reduce((a, b) => a.filter((c) => !b.includes(c)))) {
347348
// Remove it from in memory
348349
delete this._collection._docs._map[id];
349350
// Remove it from storage
350351
this.saveDocument({ _id: id }, true);
351-
});
352+
}
352353

353354
this.invalidate();
354355
}

0 commit comments

Comments
 (0)