crystal
crystal copied to clipboard
Raise a GraphQL.js PR to allow enum values to be a callback
The polymorphism filtering support in #1817 only wants to add types to the enum that will exist at runtime. These types might be built but then it turns out that they have no fields, so we throw them away, but determining this can cause a cycle if we don't do it via a callback... Or something like that.
Basically: we build the enum because it's needed by a field, building the enum requires us to check the type exists and is non-empty, so we do that, which ultimately leads to another field needing this enum type => construction cycle. If we could make values
a callback then referencing the enum before it's fully built would be safe and the cycle would be broken.
Recoverable error occurred: Error: Construction cycle detected: RelationalItemsType is already being built (build stack: Query>Organization>LogEntry>Person>RelationalItemsType>RelationalTopic>RelationalPost>RelationalDivider>RelationalChecklist>RelationalChecklistItem). Most likely this means that you forgot to use a callback for 'fields', 'interfaces', 't
ypes', etc. when defining a type.
at Object.getTypeByName (/home/benjie/Dev/graphile/crystal/graphile-build/graphile-build/src/makeNewBuild.ts:369:15)
at /home/benjie/Dev/graphile/crystal/graphile-build/graphile-build-pg/src/plugins/PgPolymorphismOnlyArgumentPlugin.ts:185:22
https://github.com/graphql/graphql-js/pull/4018