Skip to content

Conversation

rmosolgo
Copy link
Owner

@rmosolgo rmosolgo commented Aug 26, 2025

Extracted from #5389

Unify resolution of Lazy objects (Promises) with Dataloader.

TODO:

  • Track down remaining incompatibilities
  • Add Resolve back to the project with deprecation warnings
  • Remove steps_to_rerun_after_lazy if it's unused

cc @gmac perhaps relevant to your interests, this change would make dataloader.run do everything

@gmac
Copy link
Contributor

gmac commented Aug 31, 2025

That’s interesting… so I could just go through and queue a whole bunch of evaluate_selections across fields and scopes, then just run dataloader once at the end of everything and then go through collecting results? Sound like a nice simplification!

@@ -389,11 +413,11 @@ def execute_multiplex(multiplex:)
# All of these get `3` as lazy value. They're resolved together,
# since they aren't _root_ mutation fields.
"lazyValue" => 3,
"i2" => { "value" => 2, "lazyValue" => 3 },
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a pretty big change. Even without use GraphQL::Dataloader, fields may be run non-depth-first. In this case, i2 ran, then i3, then i2.value (which now gets 3 instead of 2), then i3.value. I added incrementedValue to demonstrate that the fields do run as expected, but child fields run out of order.

If this test had already used GraphQL::Dataloader, it would not have passed as written. But the change from NullDataloader to FlatDataloader required this change.

@rmosolgo rmosolgo mentioned this pull request Sep 3, 2025
17 tasks
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

Successfully merging this pull request may close these issues.

2 participants