-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
In loaders it is usually necessary to access the graphql execution context.
As per NestJS documentation I attempted to do it like this:
import { CONTEXT } from "@nestjs/graphql";
@Injectable({ scope: Scope.REQUEST })
export class CanEditMatchdayLoader implements NestDataLoader<string, boolean> {
constructor(
private readonly matchdayService: MatchdayService,
@Inject(CONTEXT) private context: any,
) {
console.log(context); // prints undefined
}
generateDataLoader(): DataLoader<string, boolean> {
...
}
}
But context
appears to be undefined
no matter what I do. I assume this is caused by nestjs-dataloader
somehow, because the nestjs documentation specifically mentions this use case.
Alternatively, this would also seem to be fixed by #11
Metadata
Metadata
Assignees
Labels
No labels