Context cancelled when using @defer
- 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
Avaliação
Esta issue ainda não foi avaliada.