From 996cd36a9e2c24d5f97051474bd100adba0a4774 Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Wed, 1 Jan 2025 18:30:16 +0100 Subject: [PATCH] fix: invalidate cache on favorite --- app/(auth)/(tabs)/(favorites)/index.tsx | 4 +++- components/AddToFavorites.tsx | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/(auth)/(tabs)/(favorites)/index.tsx b/app/(auth)/(tabs)/(favorites)/index.tsx index e01f975e..afeb27a7 100644 --- a/app/(auth)/(tabs)/(favorites)/index.tsx +++ b/app/(auth)/(tabs)/(favorites)/index.tsx @@ -28,7 +28,9 @@ export default function favorites() { paddingBottom: 16, }} > - + + + ); } diff --git a/components/AddToFavorites.tsx b/components/AddToFavorites.tsx index 050c612a..2f53bbbd 100644 --- a/components/AddToFavorites.tsx +++ b/components/AddToFavorites.tsx @@ -61,6 +61,7 @@ export const AddToFavorites: React.FC = ({ item, type, ...props }) => { }, onSettled: () => { queryClient.invalidateQueries({ queryKey: [type, item.Id] }); + queryClient.invalidateQueries({ queryKey: ["home", "favorites"] }); }, }); @@ -90,6 +91,7 @@ export const AddToFavorites: React.FC = ({ item, type, ...props }) => { }, onSettled: () => { queryClient.invalidateQueries({ queryKey: [type, item.Id] }); + queryClient.invalidateQueries({ queryKey: ["home", "favorites"] }); }, });