-
Notifications
You must be signed in to change notification settings - Fork 52
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
Make BatchLoader work with the latest GraphQL versions #32
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Repository owner
deleted a comment from
coveralls
Jan 31, 2019
Repository owner
deleted a comment from
coveralls
Jan 31, 2019
This created a regression where resolvers that do not return a |
tigefa4u
pushed a commit
to tigefa4u/gitlabhq
that referenced
this pull request
Aug 27, 2019
- Due to exAspArk/batch-loader#32, we changed BatchLoader.for into BatchLoader::GraphQL.for - since our results are wrapped in a BatchLoader::GraphQL, calling `sync` during authorization is required to get real object - `graphql` now has it's own authorization system. Our `authorized?` method conflicted and required renaming
tigefa4u
pushed a commit
to tigefa4u/gitlabhq
that referenced
this pull request
Aug 27, 2019
- Due to exAspArk/batch-loader#32, we changed BatchLoader.for into BatchLoader::GraphQL.for - since our results are wrapped in a BatchLoader::GraphQL, calling `sync` during authorization is required to get real object - `graphql` now has it's own authorization system. Our `authorized?` method conflicted and required renaming
tigefa4u
pushed a commit
to tigefa4u/gitlabhq
that referenced
this pull request
Aug 27, 2019
- Due to exAspArk/batch-loader#32, we changed BatchLoader.for into BatchLoader::GraphQL.for - since our results are wrapped in a BatchLoader::GraphQL, calling `sync` during authorization is required to get real object - `graphql` now has it's own authorization system. Our `authorized?` method conflicted and required renaming
tigefa4u
pushed a commit
to tigefa4u/gitlabhq
that referenced
this pull request
Aug 27, 2019
- Due to exAspArk/batch-loader#32, we changed BatchLoader.for into BatchLoader::GraphQL.for - since our results are wrapped in a BatchLoader::GraphQL, calling `sync` during authorization is required to get real object - `graphql` now has it's own authorization system. Our `authorized?` method conflicted and required renaming
tigefa4u
pushed a commit
to tigefa4u/gitlabhq
that referenced
this pull request
Aug 27, 2019
- Due to exAspArk/batch-loader#32, we changed BatchLoader.for into BatchLoader::GraphQL.for - since our results are wrapped in a BatchLoader::GraphQL, calling `sync` during authorization is required to get real object - `graphql` now has it's own authorization system. Our `authorized?` method conflicted and required renaming
tigefa4u
pushed a commit
to tigefa4u/gitlabhq
that referenced
this pull request
Aug 29, 2019
- Due to exAspArk/batch-loader#32, we changed BatchLoader.for into BatchLoader::GraphQL.for - since our results are wrapped in a BatchLoader::GraphQL, calling `sync` during authorization is required to get real object - `graphql` now has it's own authorization system. Our `authorized?` method conflicted and required renaming
tigefa4u
pushed a commit
to tigefa4u/gitlabhq
that referenced
this pull request
Aug 29, 2019
- Due to exAspArk/batch-loader#32, we changed BatchLoader.for into BatchLoader::GraphQL.for - since our results are wrapped in a BatchLoader::GraphQL, calling `sync` during authorization is required to get real object - `graphql` now has it's own authorization system. Our `authorized?` method conflicted and required renaming
tigefa4u
pushed a commit
to tigefa4u/gitlabhq
that referenced
this pull request
Aug 30, 2019
- Due to exAspArk/batch-loader#32, we changed BatchLoader.for into BatchLoader::GraphQL.for - since our results are wrapped in a BatchLoader::GraphQL, calling `sync` during authorization is required to get real object - `graphql` now has it's own authorization system. Our `authorized?` method conflicted and required renaming
tigefa4u
pushed a commit
to tigefa4u/gitlabhq
that referenced
this pull request
Aug 30, 2019
- Due to exAspArk/batch-loader#32, we changed BatchLoader.for into BatchLoader::GraphQL.for - since our results are wrapped in a BatchLoader::GraphQL, calling `sync` during authorization is required to get real object - `graphql` now has it's own authorization system. Our `authorized?` method conflicted and required renaming
tigefa4u
pushed a commit
to tigefa4u/gitlabhq
that referenced
this pull request
Aug 30, 2019
- Due to exAspArk/batch-loader#32, we changed BatchLoader.for into BatchLoader::GraphQL.for - since our results are wrapped in a BatchLoader::GraphQL, calling `sync` during authorization is required to get real object - `graphql` now has it's own authorization system. Our `authorized?` method conflicted and required renaming
tigefa4u
pushed a commit
to tigefa4u/gitlabhq
that referenced
this pull request
Sep 3, 2019
- Due to exAspArk/batch-loader#32, we changed BatchLoader.for into BatchLoader::GraphQL.for - since our results are wrapped in a BatchLoader::GraphQL, calling `sync` during authorization is required to get real object - `graphql` now has it's own authorization system. Our `authorized?` method conflicted and required renaming
maxlazio
pushed a commit
to gitlabhq/gitlabhq
that referenced
this pull request
Sep 4, 2019
- Due to exAspArk/batch-loader#32, we changed BatchLoader.for into BatchLoader::GraphQL.for - since our results are wrapped in a BatchLoader::GraphQL, calling `sync` during authorization is required to get real object - `graphql` now has it's own authorization system. Our `authorized?` method conflicted and required renaming
tigefa4u
pushed a commit
to tigefa4u/gitlabhq
that referenced
this pull request
Sep 9, 2019
- Due to exAspArk/batch-loader#32, we changed BatchLoader.for into BatchLoader::GraphQL.for - since our results are wrapped in a BatchLoader::GraphQL, calling `sync` during authorization is required to get real object - `graphql` now has it's own authorization system. Our `authorized?` method conflicted and required renaming
17 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL;DR
graphql
gem version1.8.6
or lower, you can continue usingBatchLoader
.graphql
gem version1.8.7
or greater, you need to replaceBatchLoader.for
withBatchLoader::GraphQL.for
to make it work within your GraphQL resolvers (methods).Since version v1.0.0,
BatchLoader
behaves as a lazy object. It only starts batching when it needs to resolve the values:At the same time,
graphql-ruby
gem implements a general adapter interface for different lazy execution mechanisms. This interface relies on an instance class method to detect whether an object is lazy or not. Unfortunately, since callingbatch_loader.class
tries to resolve the values, it is being resolved with N+1 queries bygraphql-ruby
gem itself.I suggested a few other potentially more flexible solutions for
graphql-ruby
to detect lazy objects such as duck typing or using explicit arguments. But it looks like it won't be implemented. To fix the issueBatchLoader
started wrappingBatchLoader
objects with PORO (plain old ruby objects) by usinggraphql-ruby
instrumentation.This simple
BatchLoader
object wrapping stopped working sincegraphql-ruby
version1.8.7
. This version introduced a breaking change and started detecting lazy objects before the instrumentation.In order to fix the compatibility again, this PR introduces
BatchLoader::GraphQL
- a simple PORO with extra 20 lines of code to wrapBatchLoader
without relying ongraphql-ruby
instrumentation. For example:Related to rmosolgo/graphql-ruby#1778. Fixes #22, #26, #30.