From 2ad4c58dcd3a67d985d48777ef31a949a15812a3 Mon Sep 17 00:00:00 2001 From: Maurits <3502523+WhoCarrot@users.noreply.github.com> Date: Mon, 6 Jul 2026 03:10:36 +0200 Subject: [PATCH] fix: startup resume-seek cancelled when shuffle is enabled (#2203) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit applyStartupSeek() compared the armed target song against getQueue().items[player.index], but player.index is a position in the shuffled order while getQueue().items is always the default order. With shuffle enabled the lookup resolves to the wrong song, the uniqueId check fails, and the startup resume-seek is silently cancelled — the track then plays from 0:00 and the progress poller overwrites the persisted timestamp. Use getCurrentSong() instead, which maps the index through queue.shuffled, matching how the seek target is armed. Fixes #2202 Co-authored-by: Maurits Co-authored-by: Claude Fable 5 --- src/renderer/features/player/hooks/use-queue-restore.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/renderer/features/player/hooks/use-queue-restore.ts b/src/renderer/features/player/hooks/use-queue-restore.ts index 1aae370e5..4d443645f 100644 --- a/src/renderer/features/player/hooks/use-queue-restore.ts +++ b/src/renderer/features/player/hooks/use-queue-restore.ts @@ -78,9 +78,7 @@ export const useInitialTimestampRestore = () => { } const targetUniqueId = startupSeekTargetUniqueIdRef.current; - const currentUniqueId = usePlayerStore.getState().getQueue().items[ - usePlayerStore.getState().player.index - ]?._uniqueId; + const currentUniqueId = usePlayerStore.getState().getCurrentSong()?._uniqueId; if (targetUniqueId && currentUniqueId !== targetUniqueId) { cancelStartupSeek();