fix(subtitles): rebuild VideoContext track callbacks when api.basePath changes

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.
This commit is contained in:
Gauvain
2026-06-30 01:19:18 +02:00
parent 08efa1b0f7
commit 1f54ccc52c

View File

@@ -354,7 +354,16 @@ export const VideoProvider: React.FC<{ children: ReactNode }> = ({
}; };
fetchTracks(); 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 ( return (
<VideoContext.Provider value={{ subtitleTracks, audioTracks }}> <VideoContext.Provider value={{ subtitleTracks, audioTracks }}>