Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Reports incorrect pagination totals #213

Open
1 of 3 tasks
savetheclocktower opened this issue Dec 26, 2023 · 4 comments
Open
1 of 3 tasks

[BUG] Reports incorrect pagination totals #213

savetheclocktower opened this issue Dec 26, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@savetheclocktower
Copy link

Is this Bug Present in the upstream API Server?

  • Yes
  • No
  • Unsure

What is the Bug

The query-total header is returning the total number of pages, not the total number of results. That's why pagination controls look wrong.

How to Replicate the Bug

Look at the query-total header on this endpoint:

curl -I "https://api.pulsar-edit.dev/api/packages?service=outline-view&serviceType=provided"
query-total: 4

Now count how many results are returned on the same endpoint for the first page alone:

curl "https://api.pulsar-edit.dev/api/packages?service=outline-view&serviceType=provided" | jq
30
@savetheclocktower savetheclocktower added the bug Something isn't working label Dec 26, 2023
@savetheclocktower
Copy link
Author

Here's your problem:

https://github.com/pulsar-edit/package-backend/blob/main/src/database.js#L1625-L1627

Terminology-wise, you probably want to distinguish count and total from each other. Maybe rename them to result-count & total-pages.

@confused-Techie
Copy link
Member

@savetheclocktower Just to clarify, did #215 fully address this concern?

@savetheclocktower
Copy link
Author

No, I believe this still needs a fix on the frontend.

@confused-Techie
Copy link
Member

Thanks for clarifying, just wanting to check in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants