strawberry-graphql / strawberry-django

Strawberry GraphQL Django extension
MIT License
391 stars 115 forks source link

test(listconnectionwithtotalcount): check the number of SQL queries when only fetching totalCount #525

Closed euriostigue closed 1 month ago

euriostigue commented 1 month ago

The ListConnectionWithTotalCount always requires 2 queries, even if the edges or pageInfo aren't queried. Ideally, this only requires 1 SQL query.

Description

The required fix will be in the strawberry library. I will be submitting a PR for that shortly. I have added tests here that will pass after those changes have merged and this library uses the latest release.

Types of Changes

Issues Fixed or Closed by This PR

397

Checklist

bellini666 commented 1 month ago

Hey @euriostigue ,

Yes, you got a point. We won't trigger an extra query for totalCount when only retrieving edges, but the opposite does happen.

Please mark me as a reviewer on strawberry's PR and I'll try to review it ASAP. Let me know if you need help with anything :)

bellini666 commented 1 month ago

Hey @euriostigue ,

Yes, you got a point. We won't trigger an extra query for totalCount when only retrieving edges, but the opposite does happen.

Please mark me as a reviewer on strawberry's PR and I'll try to review it ASAP. Let me know if you need help with anything :)

nvm my comment, already reviewed it in https://github.com/strawberry-graphql/strawberry/pull/3480

euriostigue commented 1 month ago

@bellini666 I upgraded the strawberry version and the added test passes now

bellini666 commented 1 month ago

@bellini666 I upgraded the strawberry version and the added test passes now

Nice, thank you! 😊