fix(ui): prevent "Play Next" restarting play at top of queue (#5049)

Set playIndex when rebuilding the queue in reducePlayNext so the music
player library knows which track is currently playing. Without this, the
library's loadNewAudioLists defaults playIndex to 0, causing playback to
restart from the top of the queue on rapid "Play Next" actions.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Alanna 2026-02-17 08:34:24 -05:00 committed by GitHub
parent b64d8ad334
commit a20d56c137
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -127,10 +127,12 @@ const reducePlayNext = (state, { data }) => {
const newQueue = []
const current = state.current || {}
let foundPos = false
let currentIndex = 0
state.queue.forEach((item) => {
newQueue.push(item)
if (item.uuid === current.uuid) {
foundPos = true
currentIndex = newQueue.length - 1
Object.keys(data).forEach((id) => {
newQueue.push(mapToAudioLists(data[id]))
})
@ -145,6 +147,7 @@ const reducePlayNext = (state, { data }) => {
return {
...state,
queue: newQueue,
playIndex: foundPos ? currentIndex : undefined,
clear: true,
}
}