fix: bug when multiple branches of split data tree point to same item

This commit is contained in:
Vjacheslav Trushkin 2022-10-15 19:23:02 +03:00
parent a67e37fec1
commit b137290974
3 changed files with 5971 additions and 2 deletions

View File

@ -115,7 +115,7 @@ export function searchSplitRecordsTreeForSet<T>(tree: SplitDataTree<T>, keywords
function search(tree: SplitDataTree<T>, keywords: string[]) {
if (!tree.split) {
// Not split
map.set(tree.match, keywords);
map.set(tree.match, keywords.concat(map.get(tree.match) || []));
return;
}
@ -140,7 +140,7 @@ export function searchSplitRecordsTreeForSet<T>(tree: SplitDataTree<T>, keywords
search(tree.next, next);
}
if (matches.length) {
map.set(tree.match, matches);
map.set(tree.match, matches.concat(map.get(tree.match) || []));
}
}
search(tree, keywords);

5900
tests/fixtures/emojione-v1.json vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long