fullstack-graphql-airbnb-clone icon indicating copy to clipboard operation
fullstack-graphql-airbnb-clone copied to clipboard

How many dataloaders do we need ?

Open gotexis opened this issue 6 years ago • 1 comments

Hey, do you create 1 loader for each type of entity and that's enough? no need for separate loaders for subqueries? So if you query

{Article (where: {id: 1})
    {
        Comments  { id }  
    }
}

, if you have a CommentLoader that will load as only 2 SQL calls?

Or do we need a CommentByArticleLoader to only be used with this query?

gotexis avatar Jun 25 '19 02:06 gotexis

You'll sometimes need to create separate loaders for subqueries

in this case I would do CommentByArticleLoader

benawad avatar Jun 25 '19 03:06 benawad