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({...@@ -468,6 +468,18 @@ export function PullRequestSummaryTab({
468 const hiddenCommentCount = detail.comments.length - recentComments.length;468 const hiddenCommentCount = detail.comments.length - recentComments.length;
469 const [commentOrder, setCommentOrder] = useState<"newest" | "oldest">("newest");469 const [commentOrder, setCommentOrder] = useState<"newest" | "oldest">("newest");
470 const visibleComments = orderPullRequestComments(recentComments, commentOrder);470 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;
471 // Read from the whole conversation, not the window shown below it: a verdict older than the483 // Read from the whole conversation, not the window shown below it: a verdict older than the
472 // last thirty comments still stands.484 // last thirty comments still stands.
473 const reviewOutcomes = latestPullRequestReviewOutcomes(detail.comments, detail.commits);485 const reviewOutcomes = latestPullRequestReviewOutcomes(detail.comments, detail.commits);
...@@ -864,22 +876,7 @@ export function PullRequestSummaryTab({...@@ -864,22 +876,7 @@ export function PullRequestSummaryTab({
864 <p className="py-2 text-xs text-muted-foreground">No comments yet.</p>876 <p className="py-2 text-xs text-muted-foreground">No comments yet.</p>
865 ) : (877 ) : (
866 <div className="space-y-3">878 <div className="space-y-3">
867 {hiddenCommentCount > 0 ? (879 {commentOrder === "oldest" ? showOldestCommentsButton : null}
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}
883 {visibleComments.map((comment) => {880 {visibleComments.map((comment) => {
884 const thread = threadByCommentId.get(comment.id);881 const thread = threadByCommentId.get(comment.id);
885 const body = visibleBody(comment.body);882 const body = visibleBody(comment.body);
...@@ -991,6 +988,7 @@ export function PullRequestSummaryTab({...@@ -991,6 +988,7 @@ export function PullRequestSummaryTab({
991 </article>988 </article>
992 );989 );
993 })}990 })}
991 {commentOrder === "newest" ? showOldestCommentsButton : null}
994 </div>992 </div>
995 )}993 )}
996 </>994 </>