authorgravatar for maria@kuuro.netmaria <maria@kuuro.net> 2026-09-03 01:43:21-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-03 01:43:21-04:00
log48ba76bc26337f23d1f0991bbac51f996a3333dc
tree9c80686b056f6883d41ab376cc385648208d4bb0
parent6cf0c6ea55d281f65c80502ec1871b0adf472025
signature Signed by PGP key B5690EEEBB952194

fix(web): collapse oldest pull request comments (#9323)

Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>

1 files changed, 14 insertions(+), 16 deletions(-)

apps/web/src/components/pullRequest/PullRequestSummaryTab.tsx+14-16
......@@ -468,6 +468,18 @@ export function PullRequestSummaryTab({
468468 const hiddenCommentCount = detail.comments.length - recentComments.length;
469469 const [commentOrder, setCommentOrder] = useState<"newest" | "oldest">("newest");
470470 const visibleComments = orderPullRequestComments(recentComments, commentOrder);
471 const showOldestCommentsButton =
472 hiddenCommentCount > 0 ? (
473 <Button
474 size="sm"
475 variant="outline"
476 className="w-full"
477 onClick={() => setShown({ url: detail.url, count: shownComments + COMMENT_PAGE })}
478 >
479 Show {Math.min(hiddenCommentCount, COMMENT_PAGE)} oldest{" "}
480 {hiddenCommentCount === 1 ? "comment" : "comments"}
481 </Button>
482 ) : null;
471483 // Read from the whole conversation, not the window shown below it: a verdict older than the
472484 // last thirty comments still stands.
473485 const reviewOutcomes = latestPullRequestReviewOutcomes(detail.comments, detail.commits);
......@@ -864,22 +876,7 @@ export function PullRequestSummaryTab({
864876 <p className="py-2 text-xs text-muted-foreground">No comments yet.</p>
865877 ) : (
866878 <div className="space-y-3">
867 {hiddenCommentCount > 0 ? (
868 // Hundreds of comments are hundreds of markdown renders, and the ones worth
869 // opening a pull request for are the recent ones. The rest are one press away and
870 // stay rendered once asked for.
871 <Button
872 size="sm"
873 variant="outline"
874 className="w-full"
875 onClick={() =>
876 setShown({ url: detail.url, count: shownComments + COMMENT_PAGE })
877 }
878 >
879 Show {Math.min(hiddenCommentCount, COMMENT_PAGE)} earlier{" "}
880 {hiddenCommentCount === 1 ? "comment" : "comments"}
881 </Button>
882 ) : null}
879 {commentOrder === "oldest" ? showOldestCommentsButton : null}
883880 {visibleComments.map((comment) => {
884881 const thread = threadByCommentId.get(comment.id);
885882 const body = visibleBody(comment.body);
......@@ -991,6 +988,7 @@ export function PullRequestSummaryTab({
991988 </article>
992989 );
993990 })}
991 {commentOrder === "newest" ? showOldestCommentsButton : null}
994992 </div>
995993 )}
996994 </>