Closed JanStevens closed 4 years ago
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
).
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
@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.
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, 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:
BatchLoader::GraphQL.for
, then you're fine 👍 BatchLoader.for
and Interpreter
, then you'd need to use https://github.com/exAspArk/batch-loader/pull/62 (draft PR)BatchLoader.for
without Interpreter
, then it works with all GraphQL versions except the range between 1.8.7
https://github.com/rmosolgo/graphql-ruby/issues/1778 - 1.8.10
https://github.com/exAspArk/batch-loader/issues/26#issuecomment-443329962I.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
Thanks @exAspArk - came across the today and updating all our resolvers to use BatchLoader::GraphQL.for
fixed it.
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
anduse 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?