From bee4a7db66da631fc853a8d4abbf9e35e7826b9c Mon Sep 17 00:00:00 2001 From: Moritz Date: Tue, 24 Feb 2026 11:14:02 +0100 Subject: [PATCH] fix: remove debug console.log from SidebarState hook Remove the temporary console.log statement that was added during sidebar state debugging. --- assets/js/app.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/assets/js/app.js b/assets/js/app.js index b7168c4..de3f154 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -86,6 +86,16 @@ Hooks.SidebarState = { this.setSidebarState(!current) } }, + + updated() { + // LiveView patches data-sidebar-expanded back to the template default ("true") + // on every DOM update. Re-apply the stored state from localStorage after each patch. + const expanded = localStorage.getItem('sidebar-expanded') !== 'false' + const current = this.el.dataset.sidebarExpanded === 'true' + if (current !== expanded) { + this.setSidebarState(expanded) + } + }, setSidebarState(expanded) { // Convert boolean to string for consistency