Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get data from UNION types #77

Closed
MartinN3 opened this issue Jan 20, 2021 · 1 comment
Closed

Unable to get data from UNION types #77

MartinN3 opened this issue Jan 20, 2021 · 1 comment

Comments

@MartinN3
Copy link

Hello guys, im using default example config with only replacePage: false with STRAPI Graphql.

Im unable to get my fields from union types, am i missing something obvious?

There is always just __typename field and thats it.

{"__typename":"ComponentFeaturesFeatures26"}

Shall it not be so simple, i'll post more info and examples.

Thanks

@MartinN3
Copy link
Author

MartinN3 commented Jan 21, 2021

The obvious thing was possibleTypes - fragment-matcher

https://graphql-code-generator.com/docs/plugins/fragment-matcher

codegen.yaml
src/generated/possibleTypes.tsx:
plugins:
- "fragment-matcher"

src/withApollo.tsx

:34 - const cache = new InMemoryCache({ ...possibleTypes }).restore(initialState || {});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant