apollo-client
apollo-client copied to clipboard
Runtime error when passing `DocumentNode` array to `createFragmentRegistry`
Issue Description
Clone the example in https://github.com/alessbell/nonreactive.
Replace the following lines:
fragments: createFragmentRegistry(gql`
${UserFragment}
`),
with
fragments: createFragmentRegistry([UserFragment]),
This type checks, but the following runtime error occurs: Cannot read properties of undefined (reading 'filter')
at the doc.definitions.filter
line in getFragmentDefinitions
.
Link to Reproduction
https://github.com/alessbell/nonreactive
Reproduction Steps
No response
Facing this problem. I was expecting to be able to use an array of fragments based on the type documentation, but seems like this is not possible?
Having similar issue here. I have generated schema using graphql-codegen
, and I'm trying to use my fragments like this
import { UserFragmentDoc } from 'generated/graphql.ts'
const cache = new InMemoryCache({
fragments: createFragmentRegistry([UserFragmentDoc]),
})
I'm having same issue Cannot read properties of undefined (reading 'filter')
, even though my UserFragmentDoc
has correct kind and correctly types definitions