-
Notifications
You must be signed in to change notification settings - Fork 99
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
Dataloader.KV runs once, never again #74
Comments
alex-knowles
added a commit
to alex-knowles/dataloader
that referenced
this issue
Apr 12, 2019
Add a Dataloader.KV test to assert that the loader can load new data in subsequent rounds. See issue absinthe-graphql#74
I wrote a test to illustrate. In commit ef5c978: dataloader/test/dataloader/kv_test.exs Lines 63 to 76 in ef5c978
The test currently fails:
Ben is in the results from round 1, but Bruce didn't make it in round 2. |
alex-knowles
added a commit
to alex-knowles/dataloader
that referenced
this issue
Apr 15, 2019
Handle case where Dataloader.KV has some results and is asked to load an id that is neither present in 'results' or 'batches'. In this case Map.get/2 would return `nil`, which was falling through and being treated as if the id was found in the results. This replaces Map.get/2 with Map.get/3 so that we can provide an explicit value to pattern-match on (:error).
alex-knowles
added a commit
to alex-knowles/dataloader
that referenced
this issue
Apr 15, 2019
Handle case where Dataloader.KV has some results and is asked to load an id that is neither present in 'results' or 'batches'. In this case Map.get/2 would return `nil`, which was falling through and being treated as if the id was found in the results. This replaces Map.get/2 with Map.get/3 so that we can provide an explicit value to pattern-match on (:error).
Fixed by PR, thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
Dataloader.run/1
, thenDataloader.load/4
with new items and thenDataloder.run/1
again to fetch results for the new itemsDataloader.KV
is the source, the second call toDataloader.run/1
does not fetch results for new itemsDetails
It's possible that the
:load_function
I'm passing toDataloader.KV.new/1
is flawed.However, it should be easy to reproduce this behavior with a proven
:load_function
of your own.Try this at home
With
Dataloader.KV
as the source:On the other hand, if I use
Dataloader.Ecto
, I get a different result:Why this matters
When you run a GraphQL query like:
You get back:
You can get traverse one depth level of a graph, but no further 🙁
The text was updated successfully, but these errors were encountered: