Query resolver gets called multiple times (2) per single request. #992
-
I'm using type-graphql and Apollo, the client makes 1 POST request with the graphql query and my backend runs the resolver 2 times. This is not my main concern, although I'd like to know why, but the thing is that only the last of the 2 times it gets the cookies, which are essential to determine if the client is authorized to view the content or not. @Resolver(ContentModel)
export class ContentSchemaResolver {
@Query(() => ContentModel, { nullable: true })
async content(@Ctx() context: HttpContext, @Arg('id', () => ID) id: string) {
const content = await ContentModel.findOne(id);
// [...]
return content;
}
// [...]
} PS: Should I paste more code? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That doesn't look like a TypeGraphQL issue. It builds a GraphQL schema that is then called by Apollo Server (or other lib). |
Beta Was this translation helpful? Give feedback.
That doesn't look like a TypeGraphQL issue. It builds a GraphQL schema that is then called by Apollo Server (or other lib).