From 5ea7b5f3ee3c43f309b62c7da72bc31632982f5b Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Tue, 16 Sep 2025 15:01:24 -0500 Subject: [PATCH] Use same approach for both section loops --- .../controllers/nav_section_expander_controller.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/controllers/nav_section_expander_controller.js b/app/javascript/controllers/nav_section_expander_controller.js index 9f5bffd68..ab1cef62c 100644 --- a/app/javascript/controllers/nav_section_expander_controller.js +++ b/app/javascript/controllers/nav_section_expander_controller.js @@ -11,7 +11,7 @@ export default class extends Controller { toggle(event) { const section = event.target if (section.hasAttribute("data-temp-expand")) return - + const key = this.#localStorageKey(section) section.open ? localStorage.removeItem(key) @@ -20,10 +20,10 @@ export default class extends Controller { showWhileFiltering() { if (this.inputTarget.value) { - for (const section of this.sectionTargets) { + this.sectionTargets.forEach(section => { section.setAttribute("data-temp-expand", true) section.open = true - } + }) } else { this.#restoreToggles() }