Fix player crash: remove premature pollForFile in handleDownloadAndPlay

The unified effect already gates polling on dlStatus===complete, but
handleDownloadAndPlay was still calling pollForFile immediately on click,
before the download even started.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mattias Tall
2026-05-26 17:30:58 +02:00
parent fe8028c1f9
commit 623e82fb16

View File

@@ -720,8 +720,7 @@ export default function Watch() {
const handleDownloadAndPlay = useCallback(() => { const handleDownloadAndPlay = useCallback(() => {
setPlayRequested(true); setPlayRequested(true);
downloadMut.mutate(); downloadMut.mutate();
pollForFile(`/files/${youtubeVideoId}.mp4`); }, [downloadMut]);
}, [downloadMut, pollForFile, youtubeVideoId]);
const saveProgress = useCallback((secs) => { const saveProgress = useCallback((secs) => {
if (!video?.id) return; if (!video?.id) return;