Arnab Datta
11/19/2020, 3:31 PM{
search(params: {ids: [1,2]}){
id
name
}
s2:search(params: {ids: [1,2]}){
id
name
}
}
and using a small .also { println("running some expensive query") }
I was able to see that this was calling the UserQueries.search
method twice. Since the example specifically has a dataloader, I was wondering why? Isn’t the whole point of dataloaders that regardless of how the query is formed, one only calls the underlying service just once? Or is this specific to nested queries only (i.e. calls to fields of type User
say for instance a friends
field that invokes some kind of function towards the DB)? What am I misunderstanding here?dave
11/19/2020, 3:34 PMArnab Datta
11/19/2020, 3:34 PMUserQueries().search(Params(ids)).also { println("some expensive db function") }