Describe the bug
I’ve run into a pretty weird issue while using urql and I could really use some help.
The main problem is that when my app sends a query with defer or when it receives chunked data, it seems to be the last request that’s ever fired.
For example, when I open my app and navigate through random pages, everything works just fine. But when I go to a page that uses defer and then move to another random page, I get a bunch of runtime errors due to missing data. It looks like the query was resolved (cache hit), but an API request was never fired. When I refresh the page, everything works again.
After some debugging, I narrowed it down to have something to do with @urql/exchange-graphcache (if I remove the exchange it works fine). Based on the logs and urql devtools, there’s a cache hit for those queries when I there shouldn’t be. Also, when I remove defer usage, logs from the same flow show cache misses.
Do you have any suggestions what could be causing this?
Urql dev tools:
- There's no API call for the last four queries
- The fifth one (from the bottom) is the one with
defer directive


Here's a PR to GraphQL Hive with adding defer to one of the queries (and necessary setup): graphql-hive/console#1964
Reproduction
graphql-hive/console#1964
Urql version
@urql/core: 4.0.4
@urql/exchange-graphcache: 6.0.1
Validations
Describe the bug
I’ve run into a pretty weird issue while using urql and I could really use some help.
The main problem is that when my app sends a query with defer or when it receives chunked data, it seems to be the last request that’s ever fired.
For example, when I open my app and navigate through random pages, everything works just fine. But when I go to a page that uses defer and then move to another random page, I get a bunch of runtime errors due to missing data. It looks like the query was resolved (cache hit), but an API request was never fired. When I refresh the page, everything works again.
After some debugging, I narrowed it down to have something to do with
@urql/exchange-graphcache(if I remove the exchange it works fine). Based on the logs and urql devtools, there’s a cache hit for those queries when I there shouldn’t be. Also, when I remove defer usage, logs from the same flow show cache misses.Do you have any suggestions what could be causing this?
Urql dev tools:
deferdirectiveHere's a PR to GraphQL Hive with adding defer to one of the queries (and necessary setup): graphql-hive/console#1964
Reproduction
graphql-hive/console#1964
Urql version
@urql/core: 4.0.4
@urql/exchange-graphcache: 6.0.1
Validations