From 1f54ccc52ccfe43415ff4a22dbdf4f5be55f94c8 Mon Sep 17 00:00:00 2001 From: Gauvain Date: Tue, 30 Jun 2026 01:19:18 +0200 Subject: [PATCH] fix(subtitles): rebuild VideoContext track callbacks when api.basePath changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The setTrack callbacks build external-sub URLs from api?.basePath; add it to the track-building effect deps so the list rebuilds once the API is ready (otherwise online externals could resolve with undefined → notFound). Addresses CodeRabbit. --- .../video-player/controls/contexts/VideoContext.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/video-player/controls/contexts/VideoContext.tsx b/components/video-player/controls/contexts/VideoContext.tsx index d43feb70..3b3df92a 100644 --- a/components/video-player/controls/contexts/VideoContext.tsx +++ b/components/video-player/controls/contexts/VideoContext.tsx @@ -354,7 +354,16 @@ export const VideoProvider: React.FC<{ children: ReactNode }> = ({ }; fetchTracks(); - }, [tracksReady, mediaSource, offline, downloadedItem, itemId]); + // api?.basePath: the setTrack callbacks build external-sub URLs from it; rebuild + // them once the API is ready so online externals don't resolve with undefined. + }, [ + tracksReady, + mediaSource, + offline, + downloadedItem, + itemId, + api?.basePath, + ]); return (