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

@@ -585,7 +585,7 @@
const contextIndex = trackIds.indexOf(track.id);
if (contextIndex >= 0 && trackIds.length > 0) {
setPlaybackContext(
await setPlaybackContext(
'playlist',
playlist.id.toString(),
playlist.name,