graphql-platform icon indicating copy to clipboard operation
graphql-platform copied to clipboard

Fix: totalCount returned -1 when no elements were returned.

Open N-Olbert opened this issue 1 month ago • 0 comments

Summary of the changes (Less than 80 chars)

-When exposing a PageConnection<T> the totalCount was returned as -1 when no elements were returned by the quers

Closes #8564(in this specific format)

Note: This is the most straightforward way to solve the problem, by simply adjusting the fallback value. This should be safe because the totalCount field is included in the GraphQL type only when IncludeTotalCount = true. However, a different approach is to adjust Page<T>.Empty based on whether IncludeTotalCount = true was specified or not. That approach works too and may also be more future proof, but it is a breaking change and probably not necessary. You can find that approach here. Note that all tests are passing with both approaches.

N-Olbert avatar Nov 19 '25 17:11 N-Olbert