From d5ba61adf818e70f1d3d415066f6f342d70ac528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deluan=20Quint=C3=A3o?= Date: Mon, 27 Apr 2026 21:45:13 -0400 Subject: [PATCH] fix(ui): prevent autoplay when clearing the play queue (#5430) When clearing the queue, the reducer resets to initialState which lacks an autoPlay field (undefined). The autoPlay option was computed as true because undefined !== false, causing the music player library to attempt playback of the first song before internal state was fully cleared. Added a queue.length > 0 guard to the autoPlay calculation so it is never true when the queue is empty, regardless of other state flags. Fixes #5331 --- ui/src/audioplayer/Player.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/src/audioplayer/Player.jsx b/ui/src/audioplayer/Player.jsx index eba3b82d7..5599b9e1d 100644 --- a/ui/src/audioplayer/Player.jsx +++ b/ui/src/audioplayer/Player.jsx @@ -210,6 +210,7 @@ const Player = () => { audioLists: playerState.queue.map((item) => item), playIndex: playerState.playIndex, autoPlay: + playerState.queue.length > 0 && playerState.autoPlay !== false && (playerState.clear || playerState.playIndex === 0), clearPriorAudioLists: playerState.clear,