Unexpected data: null in useQuery result, possibly due to __typename: 'Subscription'
See original GitHub issueIt looks like something in graphcache fails when my nested field with type: ‘Subscription’ is queried. See sample app in gist, linked below.
urql version & exchanges:
"urql": "1.9.8",
"@urql/exchange-graphcache": "3.0.0",
Steps to reproduce See sample app in gist
Expected behavior
data
returned by useQuery
should be populated by query result
Actual behavior
data
is null
Prior conversation about this issue: https://spectrum.chat/urql/help/infinite-loop-of-query-re-fetching~53171239-62b5-4fc0-9a6e-6f0c6d5a7464
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
null in useQuery result, possibly due to __typename ... - GitHub
It looks like something in graphcache fails when my nested field with type: 'Subscription' is queried. See sample app in gist, linked below....
Read more >Apollo useQuery gives null result for the subscription in react ...
I found out the issue. There were differences in the returned values for query and subscription hence, it was failing and maybe triggering ......
Read more >Nulls in GraphQL: Cheatsheet - Hasura
The GraphQL spec says that a null result on a Non-Null type bubbles up to the next nullable parent. If this bubbling never...
Read more >Customizing the behavior of cached fields - Apollo GraphQL
You can customize how a particular field in your Apollo Client cache is read and written. To do so, you define a field...
Read more >Errors | urql Documentation
This error occurs when an unknown type is found as part of a query or fragment. Check whether your schema is up-to-date or...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @kitten! Confirmed this warning would have caught the issue I was having:
As for how I’m solving this, I think versioning the schema server-side to rename the
Subscription
type makes sense. TheRenameTypes
tool ingraphql-tools
is a nice helper for that: https://www.graphql-tools.com/docs/schema-wrapping#modifying-types@stevehollaar I’ve just worked on a quick warning that should be able to catch this edge case in #859. If you’ve got time and don’t mind, you can test it out using the preview package that CodeSandbox CI publishes 🙌 https://ci.codesandbox.io/status/FormidableLabs/urql/pr/859/builds/31993