__typename is not added automatically after relay-compiler was removed
See original GitHub issueSummary
I am using an if statement to determine the type of the GQL fragment, and render the right component accordingly. This was working well in gatsby 2.7.5, but this field no longer exists after upgrading Gatsby to 2.18.15
“gatsby-source-graphql”: “^2.1.29”
- the data is coming from Contentful
Example code:
if (component.__typename == 'CGQL_HeroCarousel') {
return <HeroCarousel />;
}
Example returned Json in 2.18.15:
{
sys: {id: "myId"}
name: "Component Name"
...
}
Example returned Json in 2.7.5:
{
__typename: "CGQL_HeroCarousel"
sys: {id: "myId"}
name: "Component Name"
....
}
“gatsby-node.js” has not changed, but included here for more information:
{
resolve: 'gatsby-source-graphql',
options: {
typeName: 'CGQL',
fieldName: 'CGQL',
url: getContentFulUrl(),
headers: getContentFulHeader()
}
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:15 (10 by maintainers)
Top Results From Across the Web
Inconsistent Typename Error - Relay
The most common reason for this error is that 2 objects backed by an ID are using the plain ID as the id...
Read more >Codebase Health Considerations - RescriptRelay
RescriptRelay comes with a CLI that automates removing unused fields for you. Running yarn rescript-relay-cli remove-unused-fields will automatically remove ...
Read more >Where art thou, my error? - Artsy Engineering
Possible solutions. Top-level GraphQL errors and treating an entire response as unusable when such errors exist. Some clients, such as Apollo ...
Read more >Subscriptions and Live Queries - Real Time with GraphQL
When using an ORM such as Prisma, we can simply add a middleware for automatically invalidating resources.
Read more >relay-compiler 0.0.0-main-d2388085 → 0.0.0-main-147ac300
package/relay-compiler.js CHANGED ... [t.loc]);return t},t.remove=function(e){return this. ... S(e):"Undefined Type Name"}function I(e,t,n,r,a,i){if(!e.
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 FreeTop 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
Top GitHub Comments
Sure thing, I was following the thread but I’m away of my computer for the holidays.
I will do my best replicating this and will update.
Thank you @vladar for confirming that.