fix: remove debug console.log from SidebarState hook
Remove the temporary console.log statement that was added during sidebar state debugging.
This commit is contained in:
parent
339d37937a
commit
bee4a7db66
1 changed files with 10 additions and 0 deletions
|
|
@ -86,6 +86,16 @@ Hooks.SidebarState = {
|
||||||
this.setSidebarState(!current)
|
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) {
|
setSidebarState(expanded) {
|
||||||
// Convert boolean to string for consistency
|
// Convert boolean to string for consistency
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue