Tag: dataloader
-
Print GraphQL query logs and integrate DataLoader
0 I have been trying to log out my query logs to see how many queries my query is performing to get the feeling why to use DataLoader. The project im working on is a star wars GraphQL api , and i noticed bad performance when doing such a query: query { film(id: 2){ title…
-
Why does async code mess up my dataloader in a graphql resolver?
0 I have a dataloader that I’m using to batch requests to a service to get my user’s addresses. The loader doesn’t batch requests correctly when the parent resolver uses async code. Here’s a general idea of what my code looks like: // User.ts import Demographic from ‘./Demographic’ export type User { name: ‘User’, description:…
-
Dataloader is using only recent context
0 I have defined a custom context as below @Component public class MyContextBuilder implements DgsCustomContextBuilder<MyContexttBuilder.MyContext> { @Override public MyContext build() { return new MyContext(); } public static class MyContext { private String customState = "Custom CID!"; public String getCustomState() { return customState; } public void setCustomState(String state) { customState = state; } } } Datafetcher…
-
GraphQL Dataloader on non-id fields?
0 We’re using NodeJS (typescript) and GraphQL for our backend. Therefore we rely heavily on dataloaders, and we get more and more field resolvers that needs to be resolved on something other than IDs. An example is a field resolver on our User object, called "follows_me". In this case we need to make a lookup…
-
How to do counts in batch for graphql data loader?
0 I’m implementing a Graphql resolver for complex datatype. I try to use a data loader to avoid N+1 problem. I have a datatype with a counter. Therefore, in one graphql query I need to perform user counting multiple times for defferent types. Currently, I’m trying to combine multiple COUNT(*) queries within one SQL query.…
-
Does it make sence to use data loader for multiple counts?
0 I’m implementing a Graphql resolver for complex datatype. I try to use a data loader to avoid N+1 problem. I have a datatype with a counter. Therefore, in one graphql query I need to perform user counting multiple times for defferent types. Currently, I’m trying to combine multiple COUNT(*) queries within one SQL query.…
-
Confusion in initialising GraphQL Dataloader in context
0 context: ({ req }) => { if (req) { return { ip: headers.userip, headers, userLanguage, decodedToken, dataLoaders: { seoDataLoader: createSeoDataLoader() } } } } Here I create a createSeoDataLoader instace for every request . now suppose if i have 50 loaders then for every request 50 loaders instance created and i think its not…
-
HotChocolate v.13 [UseProjections] attribute does not work with DataLoaders
0 I have the following GrapqhQL query: query { listTenants { totalCount items { tenantId name sites { totalCount items { siteId cmxName cmxState hosts( order: { hostId: ASC } where: { hostName: { neq: "ans" } } skip: 4 take: 2 ) { totalCount items { hostId hostName siteId } } } } }…
-
Type error initializing DataLoader with Typescript
4 I’m trying to initialize an instance of DataLoader using the following code: const authorLoader = new DataLoader(async (keys:string[]) => { // Return an author for each book }); I’m getting the following error: Argument of type ‘(keys: string[]) => Promise<Author[]>’ is not assignable to parameter of type ‘BatchLoadFn<string, Author>’. Types of parameters ‘keys’ and…