Skip to content

Commit

Permalink
fix: check input before doing query (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
bill-min authored Jul 19, 2024
1 parent 8b2b9b5 commit 853d5c6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"dependencies": {
"@urql/core": "^3.0.4",
"@urql/devtools": "^2.0.3",
"dequal": "^2.0.3",
"make-fetch-happen": "^13.0.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { dequal } from 'dequal';
import { pipe, subscribe } from "wonka";
import { readyLookup, getClient, hydrateQuery } from "@internal/client";
class {
Expand Down Expand Up @@ -37,8 +38,21 @@ class {
this.state = state;
}
onInput() {
this.shouldQuery = true;
onInput(input) {
let { name, query, variables, requestPolicy } = input;
if (
this.name !== name ||
this.query !== query ||
this.requestPolicy !== requestPolicy ||
!dequal(this.variables, variables)
) {
this.name = name;
this.query = query;
this.variables = variables;
this.requestPolicy = requestPolicy;
this.shouldQuery = true;
}
}
onUpdate() {
Expand Down

0 comments on commit 853d5c6

Please sign in to comment.