From bc58103c62a10d8ae26f27e906009b9191068682 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sun, 26 Apr 2026 21:21:40 -0400 Subject: [PATCH] feat(ui): persist library selection across page navigation Save the selected library to localStorage when the user changes the dropdown on the bookshelf page, and restore it on every page load via a new restoreLibrarySelection() call in the header Alpine component. This ensures that when a user navigates between dashboard, bookshelf, collections, etc., their last-chosen library filter is automatically re-applied rather than resetting to the default. Changes: - web/src/bookshelf.ts: listen for change events on #library-select and persist the value to localStorage - web/src/header.ts: add restoreLibrarySelection() which checks localStorage and sets the matching dropdown option on page load - templates/header.templ: call restoreLibrarySelection() in x-init - templates/header_templ.go: regenerated from templ source --- templates/header.templ | 2 +- templates/header_templ.go | 2 +- web/src/bookshelf.ts | 3 +++ web/src/header.ts | 31 ++++++++++++++++++++++++++++++- 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/templates/header.templ b/templates/header.templ index ddcafe0..1bbae1a 100644 --- a/templates/header.templ +++ b/templates/header.templ @@ -1,7 +1,7 @@ package templates templ Header(user User, currentPath string) { -