Say the Absinthe resolver returns a struct with an assoc that has already been loaded, e.g.
%Organization{
name: "Acme",
members: []
}
When using Dataloader with Absinthe to load the :members
for the organization, dataloader will still execute a query to fetch the members while it was already loaded (set to []
).
I found this old merge:
- Dataloader Ecto: Prevent reuse of a preloaded child · Issue #18 · absinthe-graphql/dataloader · GitHub
- Prevent Ecto Caching by benwilson512 · Pull Request #19 · absinthe-graphql/dataloader · GitHub
But the above GH comments don’t really state why we ignore already preloaded associations. It only mentions consistency but I do not see why we need to execute preload queries again if those had already been executed against the db, leading to double db requests.
Any idea as to why?