And this frontend one

This commit is contained in:
shamoon
2025-08-19 01:07:02 -07:00
parent bf11dd2908
commit 39eef0b13a

View File

@@ -142,12 +142,12 @@ export class TagsComponent implements OnInit, ControlValueAccessor {
}
private removeChildren(tagIDs: number[], tag: Tag) {
if (tag.children.length > 0) {
if (tag.children?.length) {
const childIDs = tag.children.map((child) => child.id)
tagIDs = tagIDs.filter((id) => !childIDs.includes(id))
}
for (const child of tag.children) {
tagIDs = this.removeChildren(tagIDs, child)
for (const child of tag.children) {
tagIDs = this.removeChildren(tagIDs, child)
}
}
return tagIDs
}