strawberry-django icon indicating copy to clipboard operation
strawberry-django copied to clipboard

Adding total count in non-relay pagination

Open stoicsleuth opened this issue 6 months ago • 1 comments

Feature Request Type

  • [ ] Core functionality
  • [x] Alteration (enhancement/optimization) of existing feature(s)
  • [ ] New behavior

Description

(Previously mentioned in https://github.com/strawberry-graphql/strawberry-graphql-django/issues/408)

Our project very extensively uses strawberry-graphql-django to expose nodes on our models. Earlier, we faced some issues related to pagination since the library only exposed totalCount of paginated results with Relay while we hadn’t built our project on top of Relay.

We had thus overridden some class methods with a previous version of strawberry-graphql-django, which again started breaking when we tried to upgrade to the latest one. Since overriding methods for pagination is not future-proof, I wanted to propose if we can accommodate 'totalCount' for pagination in the library without going through the Relay route.

I can try creating a PR for it if the idea aligns with the library’s roadmap. Let me know your thoughts.

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

stoicsleuth avatar Dec 18 '23 06:12 stoicsleuth

Hey @stoicsleuth ,

First of all:

Since overriding methods for pagination is not future-proof

We are not planning on breaking API for those in the future. The only reason for such breakeage would be if we had to do something which is incompatible with the current API

But having said that, sure, I think it is fair to have an alternative pagination structure which can expose extra data (such as totalCount) and is not reliant on relay.

PRs are totally welcomed! :)

bellini666 avatar Dec 18 '23 14:12 bellini666