From a20d56c137d3c7ac5e37e642e51df89261163179 Mon Sep 17 00:00:00 2001 From: Alanna Date: Tue, 17 Feb 2026 08:34:24 -0500 Subject: [PATCH] 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 --- ui/src/reducers/playerReducer.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/src/reducers/playerReducer.js b/ui/src/reducers/playerReducer.js index 92fe85df..0392736e 100644 --- a/ui/src/reducers/playerReducer.js +++ b/ui/src/reducers/playerReducer.js @@ -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, } }