fix(context): fix playback context tracking bugs

Multiple critical fixes for context tracking:

1. Add 'local_library' to backend context type parser
   - Was rejecting 'local_library' causing "Invalid context type" error
   - Now properly recognized in set_playback_context command

2. Fix shuffle to not always start with first track
   - Removed logic that moved current track to front of shuffle
   - Now finds current track position in shuffled order instead
   - Shuffle is truly random, not biased to original order

3. Add missing await to all setPlaybackContext calls
   - PlaylistDetailView: await context creation
   - FavoritesView: make setFavoritesContext async + await calls
   - ArtistDetailView: await context creation
   - HomeView: await context creation
   - SearchView: await + use home_list type (search type doesn't exist)

   This fixes intermittent context tracking (race condition)

Fixes: shuffle starting with first song, Local Library context error,
intermittent playlist/favorites/artist/home/search context tracking

cc
This commit is contained in:
vicrodh committed 2026-01-19 18:31:18 -06:00
1 parent f2c3e8aedd
commit ed7984a029
7 files changed
+24 -20

No files matched your search

+2 -2
View File
@@ -357,8 +357,8 @@
// Create continue listening context
if (continueTracks.length > 0) {
const trackIds = continueTracks.map(t => t.id);
setPlaybackContext(
await setPlaybackContext(
'home_list',
'continue_listening',
'Continue Listening',