From 39e220be228495ff9fa2a4e6d68ebb24df0a26b3 Mon Sep 17 00:00:00 2001 From: Milad Date: Wed, 20 Dec 2023 02:18:37 +0000 Subject: [PATCH] add guaranteed fetch to add ingredients page --- src/app/(tabs)/my-bar.tsx | 2 -- src/hooks/useFetchIngredients.ts | 4 +++- src/hooks/useFetchMatchedRecipes.ts | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/app/(tabs)/my-bar.tsx b/src/app/(tabs)/my-bar.tsx index 24f6e05..731417c 100644 --- a/src/app/(tabs)/my-bar.tsx +++ b/src/app/(tabs)/my-bar.tsx @@ -38,7 +38,6 @@ export default function MyBarScreen() { const { deleteFromMyBar, getRecipeMatch, - ingredientRefetch, myBarRefetch, myBarLoading, partialMatchData, @@ -76,7 +75,6 @@ export default function MyBarScreen() { variables: { ingredientIds: [item.id], profileIds: [user?.id] }, onCompleted: () => { capture('my_bar:ingredient_remove', { ingredient_name: item.name }) - ingredientRefetch() myBarRefetch() totalMatchRefetch() partialMatchRefetch() diff --git a/src/hooks/useFetchIngredients.ts b/src/hooks/useFetchIngredients.ts index 9811947..3304098 100644 --- a/src/hooks/useFetchIngredients.ts +++ b/src/hooks/useFetchIngredients.ts @@ -68,7 +68,9 @@ export const useFetchIngredients = () => { fetchPolicy: 'cache-and-network', }) - const { data: selectedIngredients } = useQuery(GET_INGREDIENTS_IN_MY_BAR) + const { data: selectedIngredients } = useQuery(GET_INGREDIENTS_IN_MY_BAR, { + fetchPolicy: 'cache-and-network', + }) useEffect(() => { if (!categories) return diff --git a/src/hooks/useFetchMatchedRecipes.ts b/src/hooks/useFetchMatchedRecipes.ts index 25ee3af..12341db 100644 --- a/src/hooks/useFetchMatchedRecipes.ts +++ b/src/hooks/useFetchMatchedRecipes.ts @@ -24,8 +24,6 @@ export const useFetchMatchedRecipes = () => { error: myBarError, } = useQuery(GET_MY_BAR) - const { refetch: ingredientRefetch } = useQuery(GET_INGREDIENTS_IN_MY_BAR) - const { data: totalMatchData, refetch: totalMatchRefetch, @@ -88,7 +86,6 @@ export const useFetchMatchedRecipes = () => { return { deleteFromMyBar, getRecipeMatch, - ingredientRefetch, myBarError, myBarLoading, myBarRefetch,