After upgrading absinthe from 1.4.12 to 1.5.2, ecto from 2.1 to 3.0 and dataloader from 1.0.2 to 1.0.7 I've been having some issues with dataloader not finding items in batch. I tried to follow the steps pointed by deepankar-j at https://github.com/absinthe-graphql/absinthe/issues/746 to see if there was something related and reached to the PR that fixes the use_parent: false as default issue (https://github.com/absinthe-graphql/absinthe/pull/891) but couldn't solve my problem.
I'm following exactly the documentation to apply the dataloader to avoid N+1.
Some further details: When I query for a specific field in my application the batch 'breaks'. This is how I'm applying the dataloader and using the result to sort. When query for this field:
operations {
id
}
Implemented like this:
field :operations, list_of(:theme_clothing_operation), resolve: dataloader(Db,
:theme_clothing_operations, callback: fn(operations, _parent, _args) ->
{:ok, operations |> Enum.sort_by(fn(operation) -> operation.id end)}
end
)
But when i remove that field query it works. I'm not sure if I provided enough details or if it is in some way possible to help with only this, but I really appreciate some help or some clues of what might be happening.