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 properties inside the object just an empty object {}