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

Allow @defer to work in queries with suspense enabled (#3687)

Changed files
+11 -1
.changeset
packages
react-urql
src
hooks
+5
.changeset/shiny-eagles-join.md
···
+
---
+
'urql': minor
+
---
+
+
Support use of defer with suspense
+6 -1
packages/react-urql/src/hooks/useQuery.ts
···
const subscription = pipe(
source,
-
takeWhile(() => (suspense && !resolve) || !result),
+
takeWhile(
+
() =>
+
(suspense && !resolve) ||
+
!result ||
+
('hasNext' in result && result.hasNext)
+
),
subscribe(_result => {
result = _result;
if (resolve) resolve(result);