fix(EditProductForm): prevent unnecessary flattening of empty child nodes

This commit is contained in:
Nils-Johan Gynther
2026-04-19 19:32:14 +02:00
parent 6e297403d6
commit 43fb31d0b9
@@ -71,7 +71,7 @@ export default function EditProductForm({ product, onSaved, onDeleted }: Props)
for (const node of sorted) {
const prefix = depth === 0 ? '' : depth === 1 ? '\u00a0\u00a0\u00a0↳ ' : '\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0↳ ';
result.push({ id: node.id, name: node.name, label: prefix + node.name });
result.push(...flattenTree(node.children, depth + 1));
if (node.children?.length) result.push(...flattenTree(node.children, depth + 1));
}
return result;
}