You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to use nestjs-dataloader with something like below?
@Resolver(()=>AccountDto)exportclassAccountFieldResolver{constructor(privatequeryBus: QueryBus){}
@ResolveField(()=>[AccountDto],{name: 'account'})asyncresolveCompanyAbsences(
@Args('input'){ id }: AccountKey,
@Loader(CompanyEmployeeAbsenceLoader)accountLoader: DataLoader<AccountKey,Account>,){returnaccountLoader.load({ id });}
Seems that the interceptor is not being initialized and it fails with error You should provide interceptor ${DataLoaderInterceptor.name} globally with ${APP_INTERCEPTOR}
The text was updated successfully, but these errors were encountered:
Hey @vinaybedre I was just passing through and saw your question.
What you're trying to do is possible – you're just missing one thing: globally registering your loader.
In your top level app module, make sure to provide CompanyEmployeeAbsenceLoader:
@Module({providers: [AccountFieldResolver,// <-- you're probably providing this somewhere, alreadyCompanyEmployeeAbsenceLoader,// <-- make sure to provide your loader{provide: APP_INTERCEPTOR,useClass: DataLoaderInterceptor,},// <-- as well as the library's DataloaderInterceptor],})exportclassAppModule{}
Hi,
Is it possible to use
nestjs-dataloader
with something like below?Seems that the interceptor is not being initialized and it fails with error
You should provide interceptor ${DataLoaderInterceptor.name} globally with ${APP_INTERCEPTOR}
The text was updated successfully, but these errors were encountered: