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

Support for new GraphQL Interpreter #41

Closed
JanStevens opened this issue Mar 27, 2019 · 7 comments
Closed

Support for new GraphQL Interpreter #41

JanStevens opened this issue Mar 27, 2019 · 7 comments

Comments

@JanStevens
Copy link

I was looking at converting my own analysers to the new Interpreter and stumbled on the fact that if I enabled both use GraphQL::Analysis::AST and use GraphQL::Execution::Interpreter BatchLoader::GraphQL is not working anymore.

Reading up on it and a bit in the source code I think I know why since the ability to redefine a proc for a field is removed (in favour of simplicity and speed). More information here: https://graphql-ruby.org/queries/interpreter.html

Any chance this gem can be updated to support the new GraphQL Interpreter?

@exAspArk
Copy link
Owner

exAspArk commented Apr 1, 2019

Hey @JanStevens!

Thank you for sharing the link. I'll be able to take a look into it once the Interpreter became a default runtime and became more stable (not experimental to avoid potential breaking changes in BatchLoader).

@ghost ghost added the stale Inactive label Apr 15, 2019
@ghost
Copy link

ghost commented Apr 15, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@ghost ghost closed this as completed Apr 22, 2019
@bessey
Copy link

bessey commented Feb 17, 2020

@exAspArk, does this work now? I mean, we're just starting to use this gem on a grapqhl-ruby 1.9 project and it seems to work, but thought i'd confirm since I see nothing in the changelogs.

@ghost ghost removed the stale Inactive label Feb 17, 2020
@exAspArk
Copy link
Owner

exAspArk commented Apr 7, 2020

It seems like GraphQL::Execution::Interpreter is now considered stable since graphql gem version 1.10+ (January 2020). I'm reopening the issue, will try to make it work 🙏

@exAspArk exAspArk reopened this Apr 7, 2020
@exAspArk
Copy link
Owner

exAspArk commented Apr 8, 2020

@exAspArk, does this work now? I mean, we're just starting to use this gem on a grapqhl-ruby 1.9 project and it seems to work, but thought i'd confirm since I see nothing in the changelogs.

Long story short:

I.e. please use BatchLoader::GraphQL.for

I'm going to deprecate using BatchLoader.for in GraphQL, which adds unnecessary coupling with the graphql gem. Alternatively, it's possible to keep BatchLoader.for and wrap it:

field :user, UserType, null: false

def user # resolver
  BatchLoader::GraphQL.wrap(lazy_user)
end

def lazy_user
  BatchLoader.for...
end

@ro-savage
Copy link

Thanks @exAspArk - came across the today and updating all our resolvers to use BatchLoader::GraphQL.for fixed it.

@exAspArk
Copy link
Owner

I released a new version which still keeps compatibility with BatchLoader.for + GraphQL with Interpreter, but adds a deprecation warning. More info in the changelog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants