This commit is contained in:
seb
2026-10-08 18:48:28 +02:00
parent 30b573cc63
commit b165f86811
10 changed files with 139 additions and 30 deletions

View File

@@ -515,7 +515,11 @@ export default class CategoryTree extends PureComponent {
if (!deleteNode) return;
this.setState({ isSubmitting: true });
try {
await categoryAutomat.actions.deleteCategory(deleteNode.id);
if (getCategoryChildren(this.state.categories, deleteNode.id).length > 0) {
await categoryAutomat.actions.deleteCategoryRecursive(deleteNode.id);
} else {
await categoryAutomat.actions.deleteCategory(deleteNode.id);
}
enqueueSnackbar(`Kategorie „${deleteNode.name}“ gelöscht.`, { variant: 'success' });
if (this.props.selectedId != null && String(this.props.selectedId) === String(deleteNode.id)) {
this.props.onSelect?.(deleteNode.parentId ?? rootCategoryId);