fix: Missing separtor between notices and integrations in block menu

fix: Memory leak in block menu

closes #3330
This commit is contained in:
Tom Moor
2022-04-03 17:07:55 -07:00
parent cf71fc1108
commit 3de06b8005
2 changed files with 15 additions and 6 deletions

View File

@@ -12,14 +12,21 @@ export default function filterExcessSeparators(
return acc;
}
// trim double separators looking ahead / behind
// trim double separators looking behind
const prev = items[index - 1];
if (prev && prev.name === "separator" && item.name === "separator") {
return acc;
}
// trim double separators looking ahead only if we're in the second to last
// position and the last position is also a separator (special case)
const next = items[index + 1];
if (next && next.name === "separator" && item.name === "separator") {
if (
next &&
next.name === "separator" &&
item.name === "separator" &&
index === items.length - 2
) {
return acc;
}