diff --git a/src/components/VideoPlayerWithChapters.tsx b/src/components/VideoPlayerWithChapters.tsx index f498bf6..566a736 100644 --- a/src/components/VideoPlayerWithChapters.tsx +++ b/src/components/VideoPlayerWithChapters.tsx @@ -253,6 +253,12 @@ export const VideoPlayerWithChapters = forwardRef { + hasShownResumePromptRef.current = false; + setShowResumePrompt(false); + }, [videoId]); + // Check for saved progress and show resume prompt (only once on mount) useEffect(() => { if (!hasShownResumePromptRef.current && !progressLoading && hasProgress && progress && progress.last_position > 5) { diff --git a/src/pages/Bootcamp.tsx b/src/pages/Bootcamp.tsx index 20db97d..432b579 100644 --- a/src/pages/Bootcamp.tsx +++ b/src/pages/Bootcamp.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState, useRef } from 'react'; +import { useEffect, useState, useRef, useMemo } from 'react'; import { useParams, useNavigate } from 'react-router-dom'; import { supabase } from '@/integrations/supabase/client'; import { useAuth } from '@/hooks/useAuth'; @@ -355,7 +355,8 @@ export default function Bootcamp() { } : null; }; - const video = getVideoSource(); + // Memoize video source to prevent unnecessary re-renders + const video = useMemo(getVideoSource, [lesson.id, lesson.video_host, lesson.m3u8_url, lesson.mp4_url, lesson.youtube_url, lesson.video_url, lesson.embed_code]); // Show warning if no video available if (!video) { @@ -398,7 +399,6 @@ export default function Bootcamp() { {/* Video Player - Full Width */}