fix: Missing separtor between notices and integrations in block menu
fix: Memory leak in block menu closes #3330
This commit is contained in:
@@ -431,10 +431,12 @@ class CommandMenu<T = MenuItem> extends React.Component<Props<T>, State> {
|
||||
}
|
||||
|
||||
if (embedItems.length) {
|
||||
items.push({
|
||||
name: "separator",
|
||||
});
|
||||
items = items.concat(embedItems);
|
||||
items = items.concat(
|
||||
{
|
||||
name: "separator",
|
||||
},
|
||||
embedItems
|
||||
);
|
||||
}
|
||||
|
||||
const filtered = items.filter((item) => {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user