diff --git a/components/video-player/controls/EpisodeList.tsx b/components/video-player/controls/EpisodeList.tsx index c40983b2..949ba173 100644 --- a/components/video-player/controls/EpisodeList.tsx +++ b/components/video-player/controls/EpisodeList.tsx @@ -98,7 +98,11 @@ export const EpisodeList: React.FC = ({ item, close }) => { [seasons, seasonIndex] ); - const { data: episodes, isFetching } = useQuery({ + const { + data: episodes, + isFetching, + isFetched, + } = useQuery({ queryKey: ["episodes", item.SeriesId, selectedSeasonId], queryFn: async () => { if (!api || !user?.Id || !item.Id || !selectedSeasonId) return []; @@ -117,14 +121,15 @@ export const EpisodeList: React.FC = ({ item, close }) => { useEffect(() => { if (item?.Type === "Episode" && item.Id) { + console.log("loaded"); const index = episodes?.findIndex((ep) => ep.Id === item.Id); if (index !== undefined && index !== -1) { setTimeout(() => { scrollToIndex(index); - }, 400); + }, 500); } } - }, [episodes, item]); + }, [isFetched]); const queryClient = useQueryClient(); useEffect(() => { @@ -190,6 +195,7 @@ export const EpisodeList: React.FC = ({ item, close }) => { style={{ position: "absolute", backgroundColor: "black", + height: "100%", }} > <> @@ -221,67 +227,61 @@ export const EpisodeList: React.FC = ({ item, close }) => { - - ( - ( + + { + gotoEpisode(_item.Id); + }} > - { - gotoEpisode(_item.Id); + + + + - - - - - {_item.Name} - - - {`S${_item.ParentIndexNumber?.toString()}:E${_item.IndexNumber?.toString()}`} - - - {runtimeTicksToSeconds(_item.RunTimeTicks)} - - - - - - - {_item.Overview} + {_item.Name} + + + {`S${_item.ParentIndexNumber?.toString()}:E${_item.IndexNumber?.toString()}`} + + + {runtimeTicksToSeconds(_item.RunTimeTicks)} - )} - keyExtractor={(e: BaseItemDto) => e.Id ?? ""} - estimatedItemSize={200} - showsHorizontalScrollIndicator={false} - /> - + + + + + {_item.Overview} + + + )} + keyExtractor={(e: BaseItemDto) => e.Id ?? ""} + estimatedItemSize={200} + showsHorizontalScrollIndicator={false} + /> );