99designs / 99designs/gqlgen

Context cancelled when using @defer

未关闭
#2,771 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Go
星标
10.8k
派生
1.3k
平均合并
2 天 36 分钟
30 天内合并 PR
26

描述

### 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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。