File tree 1 file changed +4
-5
lines changed 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 6
6
InternalServerErrorException ,
7
7
NestInterceptor ,
8
8
} from '@nestjs/common' ;
9
- import { APP_INTERCEPTOR , ModuleRef , ContextIdFactory } from '@nestjs/core' ;
9
+ import { APP_INTERCEPTOR , ModuleRef } from '@nestjs/core' ;
10
10
import { GqlExecutionContext } from '@nestjs/graphql' ;
11
11
import * as DataLoader from 'dataloader' ;
12
12
import { Observable } from 'rxjs' ;
@@ -45,10 +45,9 @@ export class DataLoaderInterceptor implements NestInterceptor {
45
45
if ( ctx [ NEST_LOADER_CONTEXT_KEY ] === undefined ) {
46
46
ctx [ NEST_LOADER_CONTEXT_KEY ] = async ( type : string ) : Promise < NestDataLoader < any , any > > => {
47
47
if ( ctx [ type ] === undefined ) {
48
- try {
49
- const contextId = ContextIdFactory . getByRequest ( ctx . req ) ;
50
- ctx [ type ] = ( await this . moduleRef
51
- . resolve < NestDataLoader < any , any > > ( type , contextId , { strict : false } ) )
48
+ try {
49
+ ctx [ type ] = this . moduleRef
50
+ . get < NestDataLoader < any , any > > ( type , { strict : false } )
52
51
. generateDataLoader ( ) ;
53
52
} catch ( e ) {
54
53
throw new InternalServerErrorException ( `The loader ${ type } is not provided` + e ) ;
You can’t perform that action at this time.
0 commit comments