on-internet
← Community

Not able to use the union types on graphql using apollo client

Stack Overflow ·

I have a query that uses union types inside it. sample query person { ... on jedi{ id lightsaber } ... on mandalorian{ id beskar } } when I try to use useQuery from apolloClient it is returning the person object with empty brackets [{},{}] but when using fetch() it is returning [{id:232, lightsaber:green},{id:242, beskar: old}] I tried specifying the union type in the apollo client const client = new ApolloClient({ link: concat(authMiddleware, httpLink), cache: new InMemoryCache({ addTypename: false, possibleTypes:{PersonUnion:['jedi','mandalorian']} }), }) it is not returning the any properti

Comments

Sign in or sign up to comment and upvote.

No comments yet.