diff --git a/app/(auth)/(tabs)/(search)/index.tsx b/app/(auth)/(tabs)/(search)/index.tsx index e00af8b1..22f3ea73 100644 --- a/app/(auth)/(tabs)/(search)/index.tsx +++ b/app/(auth)/(tabs)/(search)/index.tsx @@ -331,7 +331,7 @@ export default function search() { m.Id!)} + items={movies} renderItem={(item: BaseItemDto) => ( m.Id!)} + items={series} header={t("search.series")} renderItem={(item: BaseItemDto) => ( m.Id!)} + items={episodes} header={t("search.episodes")} renderItem={(item: BaseItemDto) => ( m.Id!)} + items={collections} header={t("search.collections")} renderItem={(item: BaseItemDto) => ( m.Id!)} + items={actors} header={t("search.actors")} renderItem={(item: BaseItemDto) => ( = { - ids?: string[] | null; items?: T[]; renderItem: (item: any) => React.ReactNode; header?: string; @@ -17,7 +16,6 @@ type SearchItemWrapperProps = { }; export const SearchItemWrapper = ({ - ids, items, renderItem, header, @@ -26,33 +24,7 @@ export const SearchItemWrapper = ({ const [api] = useAtom(apiAtom); const [user] = useAtom(userAtom); - const { data, isLoading: l1 } = useQuery({ - queryKey: ["items", ids], - queryFn: async () => { - if (!user?.Id || !api || !ids || ids.length === 0) { - return []; - } - - const itemPromises = ids.map((id) => - getUserItemData({ - api, - userId: user.Id, - itemId: id, - }), - ); - - const results = await Promise.all(itemPromises); - - // Filter out null items - return results.filter( - (item) => item !== null, - ) as unknown as BaseItemDto[]; - }, - enabled: !!ids && ids.length > 0 && !!api && !!user?.Id, - staleTime: Number.POSITIVE_INFINITY, - }); - - if (!data && (!items || items.length === 0)) return null; + if (!items || items.length === 0) return null; return ( <> @@ -67,7 +39,7 @@ export const SearchItemWrapper = ({ keyExtractor={(_, index) => index.toString()} estimatedItemSize={250} /*@ts-ignore */ - data={data || items} + data={items} onEndReachedThreshold={1} onEndReached={onEndReached} //@ts-ignore