fix(mobile): show restored position before playback resumes

A paused player sends no status updates after it loads, so a restored
position waited until Play to apply and the slider showed 0:00. Seek
right away when the song is already loaded, and show the position.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
joshuafhigginsandClaude Opus 5.5 committed 2026-11-16 20:19:00 -05:00 Verified
1 parent cc9654c747
commit bb817d8af0
1 file changed
+21
@@ -656,7 +656,28 @@ export function useNativePlaylistSync({
[settleWaiters]
)
/**
* Moves the current song to `seconds` as soon as it is loaded. A paused
* player sends no further status updates once loaded, so seek right away
* when it already is, and show the position either way.
*/
const queueSeek = useCallback((seconds: number) => {
currentTimeRef.current = seconds
setCurrentTime(seconds)
const playlist = playlistRef.current
const songId = storeRef.current.getState().queue[0]
if (
playlist?.isLoaded &&
loadedSongIdsRef.current[playlist.currentIndex] === songId
) {
pendingSeekRef.current = null
// Statuses report the old position until the seek lands.
seekInFlightRef.current = true
void playlist.seekTo(seconds).finally(() => {
seekInFlightRef.current = false
})
return
}
pendingSeekRef.current = seconds
}, [])