Skip to content

Commit

Permalink
Merge pull request #13 from milad-alizadeh:bug-fix-refetching-selecte…
Browse files Browse the repository at this point in the history
…d-bar-ingredients

Add guaranteed fetch to add ingredients page
  • Loading branch information
milad-alizadeh authored Dec 20, 2023
2 parents 4314a2f + 39e220b commit fc17c53
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 0 additions & 2 deletions src/app/(tabs)/my-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export default function MyBarScreen() {
const {
deleteFromMyBar,
getRecipeMatch,
ingredientRefetch,
myBarRefetch,
myBarLoading,
partialMatchData,
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion src/hooks/useFetchIngredients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/hooks/useFetchMatchedRecipes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -88,7 +86,6 @@ export const useFetchMatchedRecipes = () => {
return {
deleteFromMyBar,
getRecipeMatch,
ingredientRefetch,
myBarError,
myBarLoading,
myBarRefetch,
Expand Down

0 comments on commit fc17c53

Please sign in to comment.