Skip to content

TotalCount returns incorrect value -1 instead of 0 #8564

@nZeus

Description

@nZeus

Product

Hot Chocolate

Version

15.1.8.0

Link to minimal reproduction

Steps to reproduce

Hello, today I noticed a small issue related to the totalCount field.

E.g. I have a simple query like

query Q {
	myEntititesQuery() {
		totalCount
		nodes {
			...
		}
	}
}

ant imagine that EF returns 0 records from the DB.

What is expected?

It is expected to have totalCount == 0

What is actually happening?

For some reason totalCount is equal to -1.
I guess it's related to the implementation here - https://github.com/ChilliCream/graphql-platform/blob/8f1394dd60d93faaa4e842a41b38f0961e629562/src/GreenDonut/src/GreenDonut.Data.EntityFramework/Extensions/PagingQueryableExtensions.cs#L194C1-L198C1 - it doesn't set the totalCount in case no entries were returned.

Relevant log output

Additional context

P.S. I use [UseConnection] if it matters

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions