Skip to content

Commit

Permalink
fix(use-data-query): only set variables if they've changed
Browse files Browse the repository at this point in the history
  • Loading branch information
ismay committed Aug 10, 2021
1 parent 147ba28 commit e96d984
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions services/data/src/react/hooks/useDataQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ export const useDataQuery = (
const identical =
stableValueHash(variables) === stableValueHash(merged)

setVariables(merged)

// If the variables are identical we'll need to trigger the refetch manually
if (identical) {
// If the variables are identical we'll need to trigger the refetch manually
return queryRefetch({
cancelRefetch: true,
throwOnError: false,
}).then(({ data }) => data)
} else {
setVariables(merged)
}
}

Expand Down

0 comments on commit e96d984

Please sign in to comment.