@devries-cameron20 / t3code-1 / commits / 5884d43481
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): sort pull request lists and timelines by time (#23588)

Co-authored-by: GPT-6.1 Sol <noreply@openai.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Victor Vogel committed Nov 1, 2026 at 15:59 UTC 5884d434813cbebdf248f12468aa09450b398a05
6 files changed +56 -19
apps/web/src/components/pullRequest/PullRequestsPage.tsx
+2 -1
@@ -43,6 +43,7 @@ import {
43 pullRequestOverrideAfterAction,
44 reusePullRequestEntries,
45 settlePullRequestOverrides,
46 + comparePullRequestsByRecency,
47 largestPullRequestReadCount,
48 } from "./pullRequestList.logic";
49 import {
@@ -564,7 +565,7 @@ export function PullRequestsPage() {
565 const held = new Set(ordered.entries.map(pullRequestEntryKey));
566 const arrived = answered.entries.filter((entry) => !held.has(pullRequestEntryKey(entry)));
567 const appended = rankPullRequestMatches(
567 - arrived.toSorted((left, right) => right.updatedAt.localeCompare(left.updatedAt)),
568 + arrived.toSorted(comparePullRequestsByRecency),
569 sentParsed.text,
570 );
571 setOrdered({ key: filterKey, source: answered, entries: [...ordered.entries, ...appended] });
apps/web/src/components/pullRequest/pullRequestDetail.logic.test.ts
+13
@@ -316,6 +316,19 @@ describe("review verdicts", () => {
316 });
317
318 describe("pull request timeline", () => {
319 + it("orders host timestamps by instant across offsets and fractional seconds", () => {
320 + const events = buildPullRequestTimeline({
321 + ...TIMELINE_SOURCE,
322 + createdAt: "2026-07-05T01:00:00+02:00",
323 + commits: [{ oid: "commit", messageHeadline: "", committedDate: "2026-07-05T00:30:00Z" }],
324 + comments: [{ ...TIMELINE_SOURCE.comments[0]!, createdAt: "2026-07-05T00:30:00.5Z" }],
325 + mergedAt: null,
326 + closedAt: null,
327 + });
328 +
329 + expect(events.map((event) => event.id)).toEqual(["c1", "commit", "created"]);
330 + });
331 +
332 it("drops a body that is nothing but a bot's HTML comment, and keeps one that says more", () => {
333 const events = buildPullRequestTimeline({
334 ...TIMELINE_SOURCE,
apps/web/src/components/pullRequest/pullRequestDetail.logic.ts
+1 -1
@@ -753,7 +753,7 @@ export function buildPullRequestTimeline(
753 },
754 ]
755 : []),
756 - ].toSorted((left, right) => right.at.localeCompare(left.at));
756 + ].toSorted((left, right) => (instant(right.at) || 0) - (instant(left.at) || 0));
757 }
758
759 const FINDING_LIMIT = 20;
apps/web/src/components/pullRequest/pullRequestList.logic.test.ts
+14
@@ -406,6 +406,20 @@ describe("merging the environments' own listings", () => {
406 ...overrides,
407 }) as Parameters<typeof mergePullRequestLists>[0][number][1];
408
409 + it("orders host timestamps by instant across offsets and fractional seconds", () => {
410 + const entries = [
411 + entry({ number: 1, updatedAt: "2026-07-05T01:00:00+02:00" }),
412 + entry({ number: 2, updatedAt: "2026-07-05T00:30:00Z" }),
413 + entry({ number: 3, updatedAt: "2026-07-05T00:30:00.5Z" }),
414 + ];
415 + const merged = mergePullRequestLists([
416 + [ENV_1, answer({ entries: entries.slice(0, 2) })],
417 + [ENV_2, answer({ entries: entries.slice(2) })],
418 + ]);
419 +
420 + expect(merged?.entries.map((row) => row.number)).toEqual([3, 2, 1]);
421 + });
422 +
423 it("tags every row with the environment that read it, newest first", () => {
424 const merged = mergePullRequestLists([
425 [ENV_1, answer({ entries: [entry({ number: 1, updatedAt: "2026-07-01T00:00:00Z" })] })],
apps/web/src/components/pullRequest/pullRequestList.logic.ts
+24 -14
@@ -469,11 +469,16 @@ export function partitionPullRequestsWithPriority<Entry extends PullRequestListE
469 others.push(entry);
470 }
471 }
472 - const byRecency = (left: Entry, right: Entry) => right.updatedAt.localeCompare(left.updatedAt);
472 return (
473 [
475 - { key: "authored", entries: [...authoredByKey.values()].toSorted(byRecency) },
476 - { key: "reviewRequested", entries: [...reviewByKey.values()].toSorted(byRecency) },
474 + {
475 + key: "authored",
476 + entries: [...authoredByKey.values()].toSorted(comparePullRequestsByRecency),
477 + },
478 + {
479 + key: "reviewRequested",
480 + entries: [...reviewByKey.values()].toSorted(comparePullRequestsByRecency),
481 + },
482 { key: "others", entries: others },
483 ] as const
484 )
@@ -564,7 +569,7 @@ export function mergePullRequestLists(
569 return {
570 viewers,
571 providers: [...providers.values()],
567 - entries: entries.toSorted((left, right) => right.updatedAt.localeCompare(left.updatedAt)),
572 + entries: entries.toSorted(comparePullRequestsByRecency),
573 errors,
574 truncated,
575 nextCursors,
@@ -660,7 +665,7 @@ export function rankPullRequestMatches<Entry extends PullRequestListEntry>(
665 if (query.trim().length === 0) return entries;
666 return entries.toSorted((left, right) => {
667 const byScore = scorePullRequestMatch(right, query) - scorePullRequestMatch(left, query);
663 - return byScore !== 0 ? byScore : right.updatedAt.localeCompare(left.updatedAt);
668 + return byScore !== 0 ? byScore : comparePullRequestsByRecency(left, right);
669 });
670 }
671
@@ -681,24 +686,29 @@ export function rankPullRequestsByMergeReadiness<Entry extends PullRequestListEn
686 if (byTier !== 0) return byTier;
687 const measured = Number(hasMeasuredSize(right)) - Number(hasMeasuredSize(left));
688 const sized = left.additions + left.deletions - (right.additions + right.deletions);
684 - return measured || sized || right.updatedAt.localeCompare(left.updatedAt);
689 + return measured || sized || comparePullRequestsByRecency(left, right);
690 });
691 }
692
693 +export function comparePullRequestsByRecency(
694 + left: PullRequestListEntry,
695 + right: PullRequestListEntry,
696 +) {
697 + const leftUpdated = toSortableTimestamp(left.updatedAt);
698 + const rightUpdated = toSortableTimestamp(right.updatedAt);
699 + const measured = Number(leftUpdated === null) - Number(rightUpdated === null);
700 + if (measured !== 0) return measured;
701 + if (leftUpdated === null || rightUpdated === null) return 0;
702 + return rightUpdated - leftUpdated;
703 +}
704 +
705 function rankByTierThenRecency<Entry extends PullRequestListEntry>(
706 entries: ReadonlyArray<Entry>,
707 tier: (entry: Entry) => number,
708 ): ReadonlyArray<Entry> {
692 - const timestamp = (entry: Entry) => toSortableTimestamp(entry.updatedAt);
709 return entries.toSorted((left, right) => {
710 const byTier = tier(left) - tier(right);
695 - if (byTier !== 0) return byTier;
696 - const leftUpdated = timestamp(left);
697 - const rightUpdated = timestamp(right);
698 - const measured = Number(leftUpdated === null) - Number(rightUpdated === null);
699 - if (measured !== 0) return measured;
700 - if (leftUpdated === null || rightUpdated === null) return 0;
701 - return rightUpdated - leftUpdated;
711 + return byTier !== 0 ? byTier : comparePullRequestsByRecency(left, right);
712 });
713 }
714
apps/web/src/components/pullRequest/pullRequestListGroups.logic.ts
+2 -3
@@ -7,6 +7,7 @@ import type {
7 import type { PullRequestTabStatusSeed } from "~/components/RightPanelTabs";
8 import { pullRequestSurfaceId } from "~/rightPanelStore";
9 import {
10 + comparePullRequestsByRecency,
11 filterPullRequestsByInvolvement,
12 groupPullRequestsByInvolvement,
13 matchesPullRequestFilters,
@@ -65,9 +66,7 @@ export function pullRequestGroups({
66 )
67 : involvementEntries;
68 if (text.length === 0) {
68 - return narrowedEntries.toSorted((left, right) =>
69 - right.updatedAt.localeCompare(left.updatedAt),
70 - );
69 + return narrowedEntries.toSorted(comparePullRequestsByRecency);
70 }
71 return narrowedEntries.filter(
72 (entry) =>