Skip to content

Commit

Permalink
(react/preact) - Force suspense to be disabled for executeQuery calls (
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten authored Nov 27, 2020
1 parent b48652b commit 685ca18
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/hungry-penguins-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@urql/preact': patch
'urql': patch
---

Add `suspense: false` to options when `executeQuery` is called explicitly.
4 changes: 3 additions & 1 deletion packages/preact-urql/src/hooks/useQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ export function useQuery<Data = any, Variables = object>(

// This is the imperative execute function passed to the user
const executeQuery = useCallback(
(opts?: Partial<OperationContext>) => update(makeQuery$(opts)),
(opts?: Partial<OperationContext>) => {
update(makeQuery$({ suspense: false, ...opts }));
},
[update, makeQuery$]
);

Expand Down
4 changes: 3 additions & 1 deletion packages/react-urql/src/hooks/useQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ export function useQuery<Data = any, Variables = object>(

// This is the imperative execute function passed to the user
const executeQuery = useCallback(
(opts?: Partial<OperationContext>) => update(makeQuery$(opts)),
(opts?: Partial<OperationContext>) => {
update(makeQuery$({ suspense: false, ...opts }));
},
[update, makeQuery$]
);

Expand Down

0 comments on commit 685ca18

Please sign in to comment.