From c1da76c9eb848b1b141f3cac08c7e58e1d8ebe48 Mon Sep 17 00:00:00 2001 From: Jonah <47046556+jwbonner@users.noreply.github.com> Date: Sat, 21 Sep 2024 11:18:03 -0400 Subject: [PATCH] Allow hiding object children --- src/hub/SourceList.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hub/SourceList.ts b/src/hub/SourceList.ts index 8555f343..21f1e224 100644 --- a/src/hub/SourceList.ts +++ b/src/hub/SourceList.ts @@ -802,16 +802,17 @@ export default class SourceList { // Hide button let hideButton = item.getElementsByClassName("hide")[0] as HTMLButtonElement; let toggleHidden = () => { - if (isChild) return; let index = Array.from(this.LIST.children).indexOf(item); let newVisible = !this.state[index].visible; this.state[index].visible = newVisible; this.updateItem(item, this.state[index]); - while (index < this.state.length) { - index++; - if (!this.isChild(index)) break; - this.state[index].visible = newVisible; - this.updateItem(this.LIST.children[index] as HTMLElement, this.state[index]); + if (!isChild) { + while (index < this.state.length) { + index++; + if (!this.isChild(index)) break; + this.state[index].visible = newVisible; + this.updateItem(this.LIST.children[index] as HTMLElement, this.state[index]); + } } }; hideButton.addEventListener("click", (event) => { @@ -833,7 +834,6 @@ export default class SourceList { // Child formatting if (isChild) { - hideButton.hidden = true; item.classList.add("child"); }