Skip to content

Commit 12bed64

Browse files
committed
instantsearch.js: Avoid group slicing
1 parent f49b389 commit 12bed64

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/js/instantsearch.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,17 @@
7676
const hierarchy = Object.entries(item.hierarchy).filter(([, value]) => value);
7777
const breadcrumbsKeys = hierarchy.map(([key]) => key);
7878
const groupNameKey = breadcrumbsKeys.shift();
79+
const groupName = item.hierarchy[groupNameKey];
7980
const entryNameKey = breadcrumbsKeys.pop();
8081
const newItem = {
8182
groupNameKey,
8283
entryNameKey,
8384
breadcrumbsKeys,
8485
item: getClearedItem(item),
8586
};
86-
const groupChildren = outputItemsMap[groupNameKey]?.children ?? [];
87+
const groupChildren = outputItemsMap[groupName]?.children ?? [];
8788

88-
outputItemsMap[groupNameKey] = {
89+
outputItemsMap[groupName] = {
8990
children: [...groupChildren, newItem],
9091
};
9192
});

0 commit comments

Comments
 (0)