From 92e78be62d85e22db5607e413c13a547a0c614d7 Mon Sep 17 00:00:00 2001 From: topkoa Date: Mon, 6 Jul 2026 19:50:11 -0400 Subject: [PATCH] Fix v3 library Filters drawer crash on saved prefs; rename Stems label applySavedPrefs() rebuilt state.filters without the `genre` key, so with saved prefs restored from localStorage state.filters.genre was undefined. Clicking Filters ran renderDrawer(), which indexes f.genre.includes(g) whenever the library has >=1 genre -> TypeError, renderDrawer aborts, and openDrawer never removes translate-x-full. The drawer stayed off-screen so the menu appeared dead. Only triggered for users with saved prefs AND a non-empty genre list, matching the intermittent report. Carry genre: [] alongside the other session-only facets (mastery, match), mirroring the default and clear-all shapes which already include it. Also rename the visible "Stems (sloppak)" drawer label to "Stems (feedpak)" to match the public format name used elsewhere in the UI. Signed-off-by: topkoa --- static/v3/songs.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/static/v3/songs.js b/static/v3/songs.js index bb21c18..b9b6d0a 100644 --- a/static/v3/songs.js +++ b/static/v3/songs.js @@ -166,15 +166,15 @@ const f = saved.filters; if (f && typeof f === 'object') { const arr = (x) => (Array.isArray(x) ? x.slice() : []); - // mastery + match are session-only facets (deliberately not + // mastery + match + genre are session-only facets (deliberately not // persisted), but the restored object must still CARRY the keys — - // the filter drawer indexes f.mastery/f.match unconditionally, so - // dropping them here breaks the drawer for anyone with saved prefs. + // the filter drawer indexes f.mastery/f.match/f.genre unconditionally, + // so dropping them here breaks the drawer for anyone with saved prefs. state.filters = { arr_has: arr(f.arr_has), arr_lacks: arr(f.arr_lacks), stem_has: arr(f.stem_has), stem_lacks: arr(f.stem_lacks), lyrics: f.lyrics || '', tunings: arr(f.tunings), - mastery: [], match: [], + mastery: [], match: [], genre: [], }; } } @@ -2821,7 +2821,7 @@ '

Filters

' + '
' + section('Arrangements', ARRANGEMENTS.map((a) => triPill('arr', a, a, triState(f.arr_has, f.arr_lacks, a))).join('')) + - section('Stems (sloppak)', STEMS.map((s) => triPill('stem', s, s, triState(f.stem_has, f.stem_lacks, s))).join('')) + + section('Stems (feedpak)', STEMS.map((s) => triPill('stem', s, s, triState(f.stem_has, f.stem_lacks, s))).join('')) + section('Lyrics', ['', '1', '0'].map((v) => '').join('')) + // Progress (mastery bands) — multi-select; server filters via song_stats. section('Progress', [['mastered', 'Mastered'], ['in_progress', 'In progress'], ['not_started', 'Not started']].map((it) => '').join('')) +