Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise a GraphQL.js PR to allow enum values to be a callback #1882

Closed
benjie opened this issue Dec 8, 2023 · 2 comments
Closed

Raise a GraphQL.js PR to allow enum values to be a callback #1882

benjie opened this issue Dec 8, 2023 · 2 comments

Comments

@benjie
Copy link
Member

benjie commented Dec 8, 2023

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.

@benjie
Copy link
Member Author

benjie commented Dec 8, 2023

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   

@benjie
Copy link
Member Author

benjie commented Feb 8, 2024

graphql/graphql-js#4018

@benjie benjie closed this as completed May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

1 participant