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

This created a regression where resolvers that do not *return* a BatchLoader::GraphQL fail to call BatchLoader::GraphQL calls that the resolver uses. #36

Closed
maletor opened this issue Feb 15, 2019 · 3 comments
Labels
stale Inactive

Comments

@maletor
Copy link

maletor commented Feb 15, 2019

This created a regression where resolvers that do not return a BatchLoader::GraphQL fail to call BatchLoader::GraphQL calls that the resolver uses.

Originally posted by @maletor in #32 (comment)

@ghost
Copy link

ghost commented Mar 1, 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 added the stale Inactive label Mar 1, 2019
@exAspArk
Copy link
Owner

exAspArk commented Mar 6, 2019

Hi @maletor,

Do you use graphql gem versions >= 1.8.7?

  • If yes, then upgrading to batch-loader version 1.3.0 should have no effect for resolvers which don't return BatchLoader::GraphQL. With graphql 1.8.7+, batching was already broken because of the breaking changes in the graphql gem.
  • If you use version graphql gem versions < 1.8.7, then resolvers with BatchLoader::GraphQL and without should work fine. I.e. it is backward compatible.

Here is the test schema which covers this case:

field :user, !UserType, resolve: ->(object, args, ctx) do
BatchLoader::GraphQL.for(object.user_id).batch do |user_ids, loader|
User.where(id: user_ids).each { |user| loader.call(user.id, user) }
end
end
field :userOld, !UserType, resolve: ->(object, args, ctx) do
BatchLoader.for(object.user_id).batch do |user_ids, loader|
User.where(id: user_ids).each { |user| loader.call(user.id, user) }
end
end

@ghost ghost removed the stale Inactive label Mar 6, 2019
@ghost ghost added the stale Inactive label Mar 20, 2019
@ghost
Copy link

ghost commented Mar 20, 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 Mar 27, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Inactive
Projects
None yet
Development

No branches or pull requests

2 participants