You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@answer.apache.org by "culfin (via GitHub)" <gi...@apache.org> on 2026/08/18 07:47:18 UTC

[PR] fix(ui): request answers page by page instead of 999 at once [answer]

culfin opened a new pull request, #1573:
URL: https://github.com/apache/answer/pull/1573

   The question page already has everything it needs to paginate: the page number comes from the URL, a `useEffect` reloads when it changes, and a `Pagination` control is rendered. Only the request ignores all of it:
   
   ```ts
   const res = await getAnswers({
     question_id: qid,
     page: 1,
     page_size: 999,
   });
   ```
   
   **Answers past the 999th are unreachable.** The list never contains them, and since the displayed count is the length of that list, the heading claims the question has exactly 999 answers. In the forum I maintain two threads are above that limit — 13368 and 10110 answers — so roughly 22000 posts could not be reached through the UI at all.
   
   **Long questions are slow.** Measured on a question with 999 answers:
   
   | | time to first answer visible |
   |---|---|
   | ordinary question | 0.2 s |
   | 999 answers | 19 s |
   
   The browser parses and hydrates a thousand posts in order to show fifteen.
   
   ## Proposed Changes
   
     - request `page` from the URL and `ANSWER_PAGE_SIZE` answers per page
     - take the total from `res.count` instead of the length of the current page, so the heading and the page count stay correct
     - name the page size once instead of repeating `15` in three places
   
   ## One behavioural note
   
   The list is filtered client-side to hide deleted answers that only their author and admins may see. With every answer loaded, counting the filtered list happened to give an exact total. Now the total comes from the server and can be off by the number of deleted answers on the current page. Filtering those server-side would remove the discrepancy entirely, but that looked out of scope for this fix.
   
   Verified with `prettier --check` against the projects config.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org
For additional commands, e-mail: issues-help@answer.apache.org


Re: [PR] fix(ui): request answers page by page instead of 999 at once [answer]

Posted by "culfin (via GitHub)" <gi...@apache.org>.
culfin commented on PR #1573:
URL: https://github.com/apache/answer/pull/1573#issuecomment-5399283785

   Folded into #1593 with its other half — the same limit on the browser side and the server side, easier to judge together than apart. Nothing is dropped, and the new one targets `dev`. Closing to keep the queue readable.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org
For additional commands, e-mail: issues-help@answer.apache.org


Re: [PR] fix(ui): request answers page by page instead of 999 at once [answer]

Posted by "culfin (via GitHub)" <gi...@apache.org>.
culfin closed pull request #1573: fix(ui): request answers page by page instead of 999 at once
URL: https://github.com/apache/answer/pull/1573


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@answer.apache.org
For additional commands, e-mail: issues-help@answer.apache.org