99designs / 99designs/gqlgen

Context cancelled when using @defer

Aberta
#2,771 3 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Go
Estrelas
10.8k
Forks
1.3k
Merge médio
2d 36min
PRs com merge (30d)
26

Descrição

### What happened?

I upgraded to the latest gqlgen generator and am attempting to use a defer directive in a query. The request works fine without the directive. When I used the directive, the initial response is as expected, "totalValue" is null and "hasNext" is included and is true. When I log the "totalValue" resolver, it is saying that the incoming context is cancelled. Attempted to use a new context just to get through the error and it still doesn't return anything to the caller.

```
{
userAccountPortfolio {
id
... TotalValue @defer
}
}

fragment TotalValue on UserAccountPortfolio {
totalValue
}
```

I'm did this through the included graphql playground as well as through the `@apollo/client`.

### What did you expect?
I expected the call to complete will the non-deferred data and then the deferred data to be returned in a second response. Here is the PR I'm modelling the expectation from: https://github.com/99designs/gqlgen/pull/2642 by @StevenACoffman

### Minimal graphql.schema and models to reproduce

```
query {
userAccountPortfolio: UserAccountPortfolio
}

type UserAccountPortfolio {
id
}

extend type UserAccountPortfolio {
totalValue: Float @goField(forceResolver: true)
}
```

### versions
- gqlgen version: v0.17.36
- go version: 1.19.11

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.