Search: auto-select Spotify when "Spotify (no auth)" is the active source

On the Search page and the global search widget (both share createSearchController),
the source picker stayed empty when the active metadata source was Spotify-no-auth,
until you clicked Spotify manually.

Root cause: get_primary_source_status reports the no-auth composite as source
'spotify_free' (for display labelling). The controller's initActiveSource set
activeSource = 'spotify_free' (it's a valid SOURCE_LABELS entry), but the icon row
renders from SOURCE_ORDER, which only has 'spotify' — so no icon matched the active
source and nothing highlighted.

Fix: normalize 'spotify_free' -> 'spotify' when deriving the initial active source
(they're the same searchable source; the picker only has a Spotify icon). Now
no-auth auto-selects Spotify like plain Spotify does. One spot, fixes both surfaces.
pull/853/head
BoulderBadgeDad 2 weeks ago
parent 8bf03a7d5e
commit ce6ce4d8d6

@ -281,7 +281,12 @@ function createSearchController({
if (resp.ok) {
const status = await resp.json();
const ms = status && status.metadata_source;
const src = (ms && typeof ms === 'object') ? ms.source : ms;
let src = (ms && typeof ms === 'object') ? ms.source : ms;
// "Spotify (no auth)" reports as 'spotify_free' for display, but the
// search picker only has a 'spotify' icon (it's the same searchable
// source). Map it so no-auth auto-selects Spotify instead of leaving
// the picker empty (no SOURCE_ORDER icon matches 'spotify_free').
if (src === 'spotify_free') src = 'spotify';
if (src && SOURCE_LABELS[src]) state.activeSource = src;
}
} catch (_) { /* best-effort */ }

Loading…
Cancel
Save