diff options
author | srichman333 <sarah_n_richman@brown.edu> | 2024-02-26 00:58:03 -0500 |
---|---|---|
committer | srichman333 <sarah_n_richman@brown.edu> | 2024-02-26 00:58:03 -0500 |
commit | a106d70af8ba9f748cdac08d50002529ef76f4ea (patch) | |
tree | 73670ff3552fef5e20725bbc650cd013c9f4322c /src/client/views/nodes/DocumentView.tsx | |
parent | 3b6b673cf1fd1e951c28210983d0b1d6176fc013 (diff) | |
parent | 27306bd0ae259241182d90cc62225609dfc8da74 (diff) |
Merge branch 'master' into dataviz-ai-sarah
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
-rw-r--r-- | src/client/views/nodes/DocumentView.tsx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 73c13b5dd..d131f72d5 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -1500,8 +1500,8 @@ ScriptingGlobals.add(function updateTagsCollection(collection: Doc) { let created = false; const matchedDocs = matchedTags .filter(tagDoc => !Doc.AreProtosEqual(collection, tagDoc)) - .map(tagDoc => { - let embedding = collectionDocs.find(doc => Doc.AreProtosEqual(tagDoc, doc)); + .reduce((aset, tagDoc) => { + let embedding = Array.from(aset).find(doc => Doc.AreProtosEqual(tagDoc, doc)) ?? collectionDocs.find(doc => Doc.AreProtosEqual(tagDoc, doc)); if (!embedding) { embedding = Doc.MakeEmbedding(tagDoc); embedding.x = wid; @@ -1510,9 +1510,11 @@ ScriptingGlobals.add(function updateTagsCollection(collection: Doc) { wid += NumCast(tagDoc._width); created = true; } - return embedding; - }); + Doc.SetContainer(embedding, collection); + 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; }); |