question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected data: null in useQuery result, possibly due to __typename: 'Subscription'

See original GitHub issue

It 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:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
stevehollaarcommented, Jun 12, 2020

Thanks @kitten! Confirmed this warning would have caught the issue I was having: image

As for how I’m solving this, I think versioning the schema server-side to rename the Subscription type makes sense. The RenameTypes tool in graphql-tools is a nice helper for that: https://www.graphql-tools.com/docs/schema-wrapping#modifying-types

1reaction
kittencommented, Jun 12, 2020

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found