-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Deprecate returning .resolve(...)
dataloader requests
#4807
Conversation
Hi @rmosolgo, I'm trying to figure out how to migrate from the deprecated We're currently using a dataloader source is Apollo's Is the deprecation there, because there'll be some additional work done in the future? Or maybe we're doing something wrong? 🤔 |
Yes, my goal is to move GraphQL-Ruby's "lazy resolution" outside the core runtime, so that it doesn't add overhead to schemas that don't use it. (Lazy resolution is a pre-Dataloader approach to batch loading, used by GraphQL-Batch among others: https://graphql-ruby.org/schema/lazy_execution.html). Dataloader was hooked up to that but I think it doesn't have to be. I looked over the docs there but I don't quite see the usage of |
Hello, same issue here. We have to use module Baseball
class CardType < Base::Object
...
def self.resolve_reference(reference, context)
context.dataloader.with(RecordLoader, Card, column: :asset_id).request(reference[:assetId])
end As |
@rmosolgo I only found Also, thank you for a very detailed explanation. I'll keep the deprecation warning for now and will be observing the development 🍿 :) |
👍 Thanks for sharing what you found, @utay. I was about to make the same suggestion. It's here in the source: You could use def self.resolve_references(references, context)
asset_ids = references.map { |r| r[:assetId] }
context.dataloader.with(RecordLoader, Card).load_all(asset_ids)
end Let me know how it goes if you give it a try! |
This was previously supported, but it shouldn't be -- it makes Dataloader dependent on the lazy-resolve system. I'm interested in working on that system so I'd like to disentangle them first.