mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-01 07:21:17 +00:00
When playing a song, the web player would sometimes briefly skip to a different song, attempt to play it, then snap back to the chosen track. Root cause: the music player can emit a PLAYER_SYNC_QUEUE carrying its previous (old) queue while it loads the newly selected one. Since #5441 widened reduceSyncQueue's hasPendingSwitch to keep playIndex alive whenever clear=true, that stale list was adopted into state with playIndex pointing at a track the user never chose. The library then played that track for an instant before the correct queue settled. Fix: when a switch is pending, only adopt a synced queue that actually contains the pending track (state.queue[playIndex], matched by trackId). A sync missing it is stale and is ignored, keeping the intended queue and pending switch alive so the next, correct sync is adopted normally.