relay: "Could not find a type name for record"
I’m experimenting with Relay and Graphql and I’ve got an error message on the browser console:
Warning: RelayQueryWriter: Could not find a type name for record
UHJvZHVjdDpwXzE=
.
Here is a runnable example of the issue: https://github.com/brenoc/relay-starter-kit/tree/relay/typenameIssue
This error disappears when I add __typename
to the query here:
https://github.com/brenoc/relay-starter-kit/blob/relay/typenameIssue/js/components/App.js#L20
What am I doing wrong?
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 1
- Comments: 29 (17 by maintainers)
Commits related to this issue
- Fetch __typename of RANGE_ADD new edges Summary: Addresses the warning noted in #474 and #653, fetching `__typename` for newly created edges. Closes https://github.com/facebook/relay/pull/657 Review... — committed to facebook/relay by josephsavona 9 years ago
- Use known typename for existing records Summary:Relay doesn't include the `__typename` field on queries/fragments/fields that have a concrete type. This means that there can be times (see issue #474)... — committed to facebook/relay by josephsavona 8 years ago
Awesome, glad I could have been of help. Thanks for fixing it!
#860 fixed the warning for me. 👍
Thanks again for all the info - I think I see what’s happening. In both cases, Relay isn’t querying for
__typename
because the type is already known (for @laurenskling the type isUser
, for @gauravtiwari it’sViewer
). We can squash this warning by using the existing information about the type in the store, i’ll send a PR.Note that in the meantime this is just a warning and Relay should be working just fine.