diff --git a/VERSION b/VERSION index 610e287..c86a09d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.23.1 +0.23.2 \ No newline at end of file diff --git a/frontend/src/components/PlayerModal.tsx b/frontend/src/components/PlayerModal.tsx index 76b41eb..7320171 100644 --- a/frontend/src/components/PlayerModal.tsx +++ b/frontend/src/components/PlayerModal.tsx @@ -93,9 +93,18 @@ export default function PlayerModal({ // `video` in the queue (the feed passes its whole list + the clicked video, no index). startIndex != null ? queue?.[startIndex]?.id ?? video.id : video.id ); - let index = queue ? queue.findIndex((v) => v.id === playingId) : 0; - if (index < 0) index = 0; - const active = queue && queue[index] ? queue[index] : video; + // Resolve the playing item from the LIVE queue so prev/next + the N/M counter track it. But + // the feed query reorders/refetches under us — e.g. auto-marking the current video watched near + // its end invalidates the feed — and the playing item can drop OUT of the loaded queue. When + // that happens we must KEEP PLAYING it, not snap back to queue[0] (which would silently jump to + // an unrelated video mid-playback, ignoring loop/auto-advance). So pin the last resolved video + // in a ref and fall back to it; neighbour stepping just treats it as sitting before queue[0]. + const foundIndex = queue ? queue.findIndex((v) => v.id === playingId) : -1; + const inQueue = foundIndex >= 0; + const activeRef = useRef