Relay/GraphQL: De-mystifying Node Interface/ID
Soon Hin Khor

Isn’t there a circular reference problem in your schema.js? First you specify your nodeDefinitions which rely on your type definitions. Then later in your type definitions you make reference to `interfaces: [nodeInterface]`.

I just encountered a problem where my nodeInterface always ended up as undefined because I spread out my type definitions across different files. It seems that I need to have all type definitions declared in schema.js in order to get in working. Importing types from other files won’t work. Also am I understanding correctly that we are only avoiding an actual circular reference problem because the nodeInterface code is never called upon the initial page load. Later when we actually depend on the nodeInterface, the types have already been declared. So what I am going to do next is dump all type definitions in schema.js and to ignore the circular reference problem highlighted by my IDE.

Thanks for the post!!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.