Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.

fix(react): Fix execute functions' state change being discarded after pause change (#3323)

Changed files
+7 -2
.changeset
packages
react-urql
+5
.changeset/serious-balloons-cheat.md
···
+
---
+
'urql': patch
+
---
+
+
Fix edge case that causes execute functions from `useQuery` and `useSubscription` to fail when they’re called in their state after a render that changes `pause`. This would previously cause internal dependencies to be outdated and the source to be discarded immediately in some cases.
+1 -1
packages/react-urql/src/hooks/useQuery.ts
···
cache,
request,
suspense,
-
getSnapshot,
args.requestPolicy,
args.context,
+
args.pause,
]
);
+1 -1
packages/react-urql/src/hooks/useSubscription.ts
···
deferDispatch(setState, state => [source, state[1], deps]);
},
-
[client, args.context, request]
+
[client, request, args.context, args.pause]
);
return [currentResult, executeSubscription];