diff --git a/frontend/app/admin/products/EditProductForm.tsx b/frontend/app/admin/products/EditProductForm.tsx index bd38d6ce..5c393ef2 100644 --- a/frontend/app/admin/products/EditProductForm.tsx +++ b/frontend/app/admin/products/EditProductForm.tsx @@ -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; }