ChilliCream / ChilliCream/graphql-platform
Connection doesn't provide a request context for method based `getTotalCount`
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 5.8k
- Forks
- 810
- Avg merge
- 15h 39m
- Merged PRs (30d)
- 98
Description
Product
Hot Chocolate
Is your feature request related to a problem?
I have a very complex query system. We have over 300 entities in our "public" API and many more besides. When returning new Connection() from data fetching methods you can provide a getTotalCount async method. This is lovely but fails if you require anything to resolve from the service provider.
For myself since the API is very complex I have undertaken to duplicate the core logic of ConnectionType, EdgeType, ConnectionPageInfo (etc) in order to provide this and other functionality, but others may benefit from simply having access to the context for getTotalCount, thus allowing expensive count operations to only happen on demand instead of needing to pre-resolve everything from the service provider.
The solution you'd like
An overload should be provided with Func<HotChocolate.Resolvers.IResolverContext, CancellationToken, ValueTask<int>> getTotalCount
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Connection implementation and how its method-based getTotalCount callback is invoked, then read the related ConnectionType, EdgeType, and ConnectionPageInfo types. Verify how IResolverContext is exposed to resolver callbacks. Done means the requested overload accepts the resolver context and cancellation token while preserving the existing callback form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100