From b927c6971e24cd43126019e8cb8879a6371cbe0a Mon Sep 17 00:00:00 2001 From: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Sat, 6 Dec 2025 21:17:19 -0700 Subject: [PATCH] fix random errors --- index.html | 2 +- src/backend/metadata/traktFunctions.ts | 17 ++++++++++++++--- src/index.tsx | 17 +++++++++++++++-- src/pages/discover/hooks/useDiscoverMedia.ts | 14 ++++++++++++++ src/pages/parts/home/HeroPart.tsx | 1 + src/setup/chromecast.ts | 15 +++++++++++---- 6 files changed, 56 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 32c22fbe..2717b38a 100644 --- a/index.html +++ b/index.html @@ -38,7 +38,7 @@ - + {props.children}; - return {props.children}; + if (normalRouter) + return ( + + {props.children} + + ); + return ( + + {props.children} + + ); } // Checks if the extension is installed diff --git a/src/pages/discover/hooks/useDiscoverMedia.ts b/src/pages/discover/hooks/useDiscoverMedia.ts index ea4e719d..1419c3ad 100644 --- a/src/pages/discover/hooks/useDiscoverMedia.ts +++ b/src/pages/discover/hooks/useDiscoverMedia.ts @@ -184,6 +184,11 @@ export function useDiscoverMedia({ // Race between the Trakt request and timeout const response = await Promise.race([traktFunction(), timeoutPromise]); + // Check if response is null + if (!response) { + throw new Error("Trakt API returned null response"); + } + // Paginate the results const pageSize = isCarouselView ? 20 : 100; // Limit to 20 items for carousels, get more for detailed views const { tmdb_ids: tmdbIds, hasMore: hasMoreResults } = paginateResults( @@ -317,6 +322,15 @@ export function useDiscoverMedia({ }, [mediaType, formattedLanguage, isCarouselView]); const fetchMedia = useCallback(async () => { + // Skip fetching recommendations if no ID is provided + if (contentType === "recommendations" && !id) { + setIsLoading(false); + setMedia([]); + setHasMore(false); + setSectionTitle(""); + return; + } + setIsLoading(true); setError(null); diff --git a/src/pages/parts/home/HeroPart.tsx b/src/pages/parts/home/HeroPart.tsx index 6f967d00..f2acd709 100644 --- a/src/pages/parts/home/HeroPart.tsx +++ b/src/pages/parts/home/HeroPart.tsx @@ -94,6 +94,7 @@ export function HeroPart({ paddingTop: `${topOffset}px`, }} onFixedToggle={stickStateChanged} + scrollElement="window" >