Skip to content

Commit 85a7d7c

Browse files
committed
undoing changes to module ref get
1 parent 6b40efc commit 85a7d7c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

index.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
InternalServerErrorException,
77
NestInterceptor,
88
} from '@nestjs/common';
9-
import { APP_INTERCEPTOR, ModuleRef, ContextIdFactory } from '@nestjs/core';
9+
import { APP_INTERCEPTOR, ModuleRef } from '@nestjs/core';
1010
import { GqlExecutionContext } from '@nestjs/graphql';
1111
import * as DataLoader from 'dataloader';
1212
import { Observable } from 'rxjs';
@@ -45,10 +45,9 @@ export class DataLoaderInterceptor implements NestInterceptor {
4545
if (ctx[NEST_LOADER_CONTEXT_KEY] === undefined) {
4646
ctx[NEST_LOADER_CONTEXT_KEY] = async (type: string) : Promise<NestDataLoader<any, any>> => {
4747
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 })
5251
.generateDataLoader();
5352
} catch (e) {
5453
throw new InternalServerErrorException(`The loader ${type} is not provided` + e);

0 commit comments

Comments
 (0)