From 3adcc60b78f34521a70a1f0f72f6b988963d8436 Mon Sep 17 00:00:00 2001 From: Luna Date: Mon, 25 May 2026 22:35:17 -0700 Subject: [PATCH] Persist web UI state across reloads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reloading the tab no longer blows away the user's context. The active view (channels / continue / recent / favourites / bookmarks / waiting / specific channel / specific playlist), the current filter input, and the chosen sort all survive a hard refresh via localStorage. - New `saveUiState()` serializes `{view, search, sort}` after every interaction that could change them: each setX() view switch, search oninput, sort onchange. - `currentViewToken()` collapses the seven `showX` booleans + the two index integers into a single string. Channel-view tokens reference the channel by name (`channel:|`) instead of by array index, so a library re-order doesn't strand the user on the wrong channel. - `restoreUiState()` runs once after the first library load completes — the channel resolution needs the `library` array populated, so the init block was wrapped in an async IIFE to sequence the two steps. Channels deleted between sessions fall back to "All" cleanly because `findIndex` returns -1 and we just leave the show* booleans at their default. 55 unit tests pass. Co-Authored-By: Claude Opus 4.7 --- src/web_ui/index.html | 86 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 75 insertions(+), 11 deletions(-) diff --git a/src/web_ui/index.html b/src/web_ui/index.html index ef6c32b..f7ea09a 100644 --- a/src/web_ui/index.html +++ b/src/web_ui/index.html @@ -120,8 +120,8 @@

yt-offline

- - +