diff --git a/components/home/InfiniteScrollingCollectionList.tsx b/components/home/InfiniteScrollingCollectionList.tsx index e5e5b7a6..de4c6462 100644 --- a/components/home/InfiniteScrollingCollectionList.tsx +++ b/components/home/InfiniteScrollingCollectionList.tsx @@ -71,7 +71,6 @@ export const InfiniteScrollingCollectionList: React.FC = ({ }, initialPageParam: 0, staleTime: 60 * 1000, // 1 minute - refetchOnMount: false, refetchOnWindowFocus: false, refetchOnReconnect: true, enabled, diff --git a/components/home/InfiniteScrollingCollectionList.tv.tsx b/components/home/InfiniteScrollingCollectionList.tv.tsx index 4b85c441..38785226 100644 --- a/components/home/InfiniteScrollingCollectionList.tv.tsx +++ b/components/home/InfiniteScrollingCollectionList.tv.tsx @@ -211,7 +211,6 @@ export const InfiniteScrollingCollectionList: React.FC = ({ }, initialPageParam: 0, staleTime: 60 * 1000, - refetchOnMount: false, refetchOnWindowFocus: false, refetchOnReconnect: true, enabled, diff --git a/components/home/ScrollingCollectionList.tsx b/components/home/ScrollingCollectionList.tsx index 3d64466f..185ad8c2 100644 --- a/components/home/ScrollingCollectionList.tsx +++ b/components/home/ScrollingCollectionList.tsx @@ -44,7 +44,6 @@ export const ScrollingCollectionList: React.FC = ({ queryKey: queryKey, queryFn, staleTime: 60 * 1000, // 1 minute - refetchOnMount: false, refetchOnWindowFocus: false, refetchOnReconnect: true, enabled: enableLazyLoading ? isInView : true, diff --git a/components/home/StreamystatsPromotedWatchlists.tsx b/components/home/StreamystatsPromotedWatchlists.tsx index 81d50675..9a4f41d3 100644 --- a/components/home/StreamystatsPromotedWatchlists.tsx +++ b/components/home/StreamystatsPromotedWatchlists.tsx @@ -80,7 +80,6 @@ const WatchlistSection: React.FC = ({ Boolean(api?.accessToken) && Boolean(user?.Id), staleTime: 5 * 60 * 1000, - refetchOnMount: false, refetchOnWindowFocus: false, }); @@ -215,7 +214,6 @@ export const StreamystatsPromotedWatchlists: React.FC< Boolean(jellyfinServerId) && Boolean(user?.Id), staleTime: 5 * 60 * 1000, - refetchOnMount: false, refetchOnWindowFocus: false, }); diff --git a/components/home/StreamystatsPromotedWatchlists.tv.tsx b/components/home/StreamystatsPromotedWatchlists.tv.tsx index 7bd2320c..7b28da1f 100644 --- a/components/home/StreamystatsPromotedWatchlists.tv.tsx +++ b/components/home/StreamystatsPromotedWatchlists.tv.tsx @@ -109,7 +109,6 @@ const WatchlistSection: React.FC = ({ Boolean(api?.accessToken) && Boolean(user?.Id), staleTime: 5 * 60 * 1000, - refetchOnMount: false, refetchOnWindowFocus: false, }); @@ -279,7 +278,6 @@ export const StreamystatsPromotedWatchlists: React.FC< Boolean(jellyfinServerId) && Boolean(user?.Id), staleTime: 5 * 60 * 1000, - refetchOnMount: false, refetchOnWindowFocus: false, }); diff --git a/components/home/StreamystatsRecommendations.tsx b/components/home/StreamystatsRecommendations.tsx index fb26708c..73b7231d 100644 --- a/components/home/StreamystatsRecommendations.tsx +++ b/components/home/StreamystatsRecommendations.tsx @@ -103,7 +103,6 @@ export const StreamystatsRecommendations: React.FC = ({ Boolean(jellyfinServerId) && Boolean(user?.Id), staleTime: 5 * 60 * 1000, // 5 minutes - refetchOnMount: false, refetchOnWindowFocus: false, }); @@ -136,7 +135,6 @@ export const StreamystatsRecommendations: React.FC = ({ enabled: Boolean(recommendationIds?.length) && Boolean(api) && Boolean(user?.Id), staleTime: 5 * 60 * 1000, - refetchOnMount: false, refetchOnWindowFocus: false, }); diff --git a/components/home/StreamystatsRecommendations.tv.tsx b/components/home/StreamystatsRecommendations.tv.tsx index bec6a490..095fe35f 100644 --- a/components/home/StreamystatsRecommendations.tv.tsx +++ b/components/home/StreamystatsRecommendations.tv.tsx @@ -134,7 +134,6 @@ export const StreamystatsRecommendations: React.FC = ({ Boolean(jellyfinServerId) && Boolean(user?.Id), staleTime: 5 * 60 * 1000, - refetchOnMount: false, refetchOnWindowFocus: false, }); @@ -167,7 +166,6 @@ export const StreamystatsRecommendations: React.FC = ({ enabled: Boolean(recommendationIds?.length) && Boolean(api) && Boolean(user?.Id), staleTime: 5 * 60 * 1000, - refetchOnMount: false, refetchOnWindowFocus: false, }); diff --git a/providers/JellyfinProvider.tsx b/providers/JellyfinProvider.tsx index 0bce8439..3d917958 100644 --- a/providers/JellyfinProvider.tsx +++ b/providers/JellyfinProvider.tsx @@ -2,7 +2,7 @@ import "@/augmentations"; import { type Api, Jellyfin } from "@jellyfin/sdk"; import type { UserDto } from "@jellyfin/sdk/lib/generated-client/models"; import { getUserApi } from "@jellyfin/sdk/lib/utils/api"; -import { useMutation } from "@tanstack/react-query"; +import { useMutation, useQueryClient } from "@tanstack/react-query"; import axios, { AxiosError } from "axios"; import { useSegments } from "expo-router"; import * as SplashScreen from "expo-splash-screen"; @@ -114,6 +114,7 @@ export const JellyfinProvider: React.FC<{ children: ReactNode }> = ({ const [secret, setSecret] = useState(null); const { setPluginSettings, refreshStreamyfinPluginSettings } = useSettings(); const { clearAllJellyseerData, setJellyseerrUser } = useJellyseerr(); + const queryClient = useQueryClient(); const headers = useMemo(() => { if (!deviceId) return {}; @@ -350,6 +351,11 @@ export const JellyfinProvider: React.FC<{ children: ReactNode }> = ({ setApi(null); setPluginSettings(undefined); await clearAllJellyseerData(); + + // Clear React Query cache to prevent data from previous account lingering + queryClient.clear(); + storage.remove("REACT_QUERY_OFFLINE_CACHE"); + // Note: We keep saved credentials for quick switching back }, onError: (error) => {