From d62555a480d6b133a7166de0dbc3ff36fbfb56b6 Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Thu, 5 Nov 2026 17:35:15 -0500 Subject: [PATCH] fix: always restart album and playlist playback --- apps/mobile/contexts/playback.tsx | 1 + apps/web/components/playback-provider.tsx | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/mobile/contexts/playback.tsx b/apps/mobile/contexts/playback.tsx index 758be5d..e3b8f31 100644 --- a/apps/mobile/contexts/playback.tsx +++ b/apps/mobile/contexts/playback.tsx @@ -859,6 +859,7 @@ export function PlaybackProvider({ children }: { children: ReactNode }) { recorded.origin ?? (recorded.playlistId ? `playlist:${recorded.playlistId}` : undefined) resetQueuePlayback() + store.update(playbackQueue.clearQueue) store.update(recipe) const firstSongId = store.getState().queue[0] if (!firstSongId) return diff --git a/apps/web/components/playback-provider.tsx b/apps/web/components/playback-provider.tsx index 973604d..524a611 100644 --- a/apps/web/components/playback-provider.tsx +++ b/apps/web/components/playback-provider.tsx @@ -388,6 +388,7 @@ export function PlaybackProvider({ children }: { children: ReactNode }) { const [queueOpen, setQueueOpen] = useState(false) const [isPlaying, setIsPlaying] = useState(false) + const [playbackStartVersion, setPlaybackStartVersion] = useState(0) const [currentTime, setCurrentTime] = useState(0) const [measuredDuration, setMeasuredDuration] = useState<{ songId: string @@ -890,7 +891,7 @@ export function PlaybackProvider({ children }: { children: ReactNode }) { return () => { audio.removeEventListener("canplay", onCanPlay) } - }, [isPlaying, currentSongId, attemptPlayback]) + }, [isPlaying, currentSongId, playbackStartVersion, attemptPlayback]) useEffect(() => { const audio = audioRef.current @@ -1069,6 +1070,7 @@ export function PlaybackProvider({ children }: { children: ReactNode }) { recorded.origin ?? (recorded.playlistId ? `playlist:${recorded.playlistId}` : undefined) const previousSongId = store.getState().queue[0] + store.update(playbackQueue.clearQueue) store.update(recipe) const firstSongId = store.getState().queue[0] if (!firstSongId) { @@ -1078,7 +1080,11 @@ export function PlaybackProvider({ children }: { children: ReactNode }) { if (firstSongId === previousSongId) { seekTo(0) } + // Repeated Play/Shuffle presses must request playback even when the + // first song and playing state have not changed. + isPlayingRef.current = true setIsPlaying(true) + setPlaybackStartVersion((version) => version + 1) recordPlay( recorded.playlistId ? { playlistId: recorded.playlistId }