aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DocumentView.tsx
diff options
context:
space:
mode:
authoralyssaf16 <alyssa_feinberg@brown.edu>2024-02-22 00:47:01 -0500
committeralyssaf16 <alyssa_feinberg@brown.edu>2024-02-22 00:47:01 -0500
commit5eea93139bf95f761ef1511fd356c853346cc201 (patch)
tree37a49c5b0f972e7ded9cc1759604098309a6aa91 /src/client/views/nodes/DocumentView.tsx
parent6347450d819adad872eab40737b2c72200c5e675 (diff)
parentd04821dee28fdecda33ff7773dd5a1567202842c (diff)
Merge branch 'master' into alyssa-starter
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
-rw-r--r--src/client/views/nodes/DocumentView.tsx10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 73c13b5dd..e8b0fc4ba 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -1500,7 +1500,8 @@ ScriptingGlobals.add(function updateTagsCollection(collection: Doc) {
let created = false;
const matchedDocs = matchedTags
.filter(tagDoc => !Doc.AreProtosEqual(collection, tagDoc))
- .map(tagDoc => {
+ .reduce((aset, tagDoc) => {
+ if (Array.from(aset).find(doc => Doc.AreProtosEqual(tagDoc, doc))) return aset;
let embedding = collectionDocs.find(doc => Doc.AreProtosEqual(tagDoc, doc));
if (!embedding) {
embedding = Doc.MakeEmbedding(tagDoc);
@@ -1510,9 +1511,10 @@ ScriptingGlobals.add(function updateTagsCollection(collection: Doc) {
wid += NumCast(tagDoc._width);
created = true;
}
- return embedding;
- });
+ aset.add(embedding);
+ return aset;
+ }, new Set<Doc>());
- created && (collection[DocData].data = new List<Doc>(matchedDocs));
+ created && (collection[DocData].data = new List<Doc>(Array.from(matchedDocs)));
return true;
});