From f842c8a41f6930dad03ef1836113817066de38dc Mon Sep 17 00:00:00 2001 From: Alex Kim Date: Mon, 9 Dec 2024 04:01:59 +1100 Subject: [PATCH] Episode list fix rendering --- .../video-player/controls/EpisodeList.tsx | 119 +++++++++--------- 1 file changed, 60 insertions(+), 59 deletions(-) diff --git a/components/video-player/controls/EpisodeList.tsx b/components/video-player/controls/EpisodeList.tsx index 949ba173..159e3448 100644 --- a/components/video-player/controls/EpisodeList.tsx +++ b/components/video-player/controls/EpisodeList.tsx @@ -98,11 +98,7 @@ export const EpisodeList: React.FC = ({ item, close }) => { [seasons, seasonIndex] ); - const { - data: episodes, - isFetching, - isFetched, - } = useQuery({ + const { data: episodes, isFetching } = useQuery({ queryKey: ["episodes", item.SeriesId, selectedSeasonId], queryFn: async () => { if (!api || !user?.Id || !item.Id || !selectedSeasonId) return []; @@ -121,15 +117,14 @@ 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); - }, 500); + }, 400); } } - }, [isFetched]); + }, [episodes, item]); const queryClient = useQueryClient(); useEffect(() => { @@ -195,7 +190,6 @@ export const EpisodeList: React.FC = ({ item, close }) => { style={{ position: "absolute", backgroundColor: "black", - height: "100%", }} > <> @@ -227,61 +221,68 @@ 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.Name} + + + {`S${_item.ParentIndexNumber?.toString()}:E${_item.IndexNumber?.toString()}`} + + + {runtimeTicksToSeconds(_item.RunTimeTicks)} + + + + + + + {_item.Overview} - - - - - {_item.Overview} - - - )} - keyExtractor={(e: BaseItemDto) => e.Id ?? ""} - estimatedItemSize={200} - showsHorizontalScrollIndicator={false} - /> + )} + keyExtractor={(e: BaseItemDto) => e.Id ?? ""} + estimatedItemSize={200} + showsHorizontalScrollIndicator={false} + /> + );