The best way to control Claude Code, Codex and more from any computer or phone
refactor(web): the pull request list's rows read the speed-mode modifier themselves (#22704)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 21, 2026 at 01:28 UTC
787e0e4a2f8a283da4782ed8cd35817ae791cb02
2 files changed
+138
-83
apps/web/src/components/pullRequest/PullRequestListGroups.tsx
new
+121
@@ -0,0 +1,121 @@
1
+import type { EnvironmentId, PullRequestAction } from "@t3tools/contracts";
2
+import { EyeIcon, LayersIcon, PenLineIcon, UsersIcon, type LucideIcon } from "lucide-react";
3
+import type { RefCallback } from "react";
4
+
5
+import { cn } from "~/lib/utils";
6
+import { useShortcutModifierState } from "~/shortcutModifierState";
7
+import { Separator } from "../ui/separator";
8
+import {
9
+ pullRequestEntryKey,
10
+ scorePullRequestMatch,
11
+ type EnvironmentPullRequestEntry,
12
+ type PullRequestGroup,
13
+} from "./pullRequestList.logic";
14
+import { PullRequestRow, type PullRequestRowTarget } from "./PullRequestRow";
15
+import type { PullRequestSpeedActionResult } from "./PullRequestSpeedActions";
16
+
17
+const GROUP_ICONS: Record<string, LucideIcon> = {
18
+ authored: PenLineIcon,
19
+ reviewRequested: EyeIcon,
20
+ others: UsersIcon,
21
+};
22
+
23
+const MATCHED_ELSEWHERE_SCORE = 10;
24
+
25
+function PullRequestGroupHeader({
26
+ group,
27
+}: {
28
+ group: { key: string; label: string; entries: ReadonlyArray<unknown> };
29
+}) {
30
+ const Icon = GROUP_ICONS[group.key] ?? LayersIcon;
31
+ return (
32
+ <div className="flex items-center gap-2 px-3 pb-1 text-xs font-medium text-muted-foreground/70">
33
+ <Icon aria-hidden className="size-3.5 shrink-0" />
34
+ <h2 className="shrink-0">{group.label}</h2>
35
+ <span className="shrink-0 tabular-nums text-muted-foreground/50">{group.entries.length}</span>
36
+ <Separator className="min-w-2 flex-1" />
37
+ </div>
38
+ );
39
+}
40
+
41
+/**
42
+ * The grouped rows. Holding Shift turns rows into speed actions, so the modifier subscription lives
43
+ * here: a key press re-renders the rows, not the page and its open pull request.
44
+ */
45
+export function PullRequestListGroups({
46
+ groups,
47
+ environmentLabels,
48
+ query,
49
+ selected,
50
+ showProvider,
51
+ statsRef,
52
+ onSelect,
53
+ hostActionsOf,
54
+ onActed,
55
+ closingKeys,
56
+ sweepingKeys,
57
+ onCloseSweepStart,
58
+}: {
59
+ groups: ReadonlyArray<PullRequestGroup<EnvironmentPullRequestEntry>>;
60
+ /** Only when rows come from more than one server, so each says which. */
61
+ environmentLabels: ReadonlyMap<EnvironmentId, string> | null;
62
+ query: string;
63
+ selected: {
64
+ readonly environmentId: string | undefined;
65
+ readonly repository: string;
66
+ readonly host: string | undefined;
67
+ readonly number: number;
68
+ } | null;
69
+ showProvider: boolean;
70
+ statsRef: RefCallback<HTMLDivElement>;
71
+ onSelect: (entry: PullRequestRowTarget) => void;
72
+ hostActionsOf: (entry: EnvironmentPullRequestEntry) => ReadonlySet<PullRequestAction>;
73
+ onActed: (result: PullRequestSpeedActionResult) => void;
74
+ closingKeys: ReadonlySet<string>;
75
+ sweepingKeys: ReadonlySet<string>;
76
+ onCloseSweepStart: (entry: EnvironmentPullRequestEntry, event: PointerEvent) => void;
77
+}) {
78
+ const modifiers = useShortcutModifierState(true);
79
+ const speedMode =
80
+ modifiers.shiftKey && !modifiers.metaKey && !modifiers.ctrlKey && !modifiers.altKey;
81
+ return (
82
+ <div className={cn("space-y-3", sweepingKeys.size > 0 && "**:pointer-events-none")}>
83
+ {groups.map((group) => (
84
+ <div key={group.key} className="space-y-0.5">
85
+ {group.label ? <PullRequestGroupHeader group={group} /> : null}
86
+ {group.entries.map((entry) => {
87
+ const entryKey = pullRequestEntryKey(entry);
88
+ const environmentLabel = environmentLabels?.get(entry.environmentId);
89
+ return (
90
+ <PullRequestRow
91
+ key={entryKey}
92
+ statsKey={entryKey}
93
+ statsRef={statsRef}
94
+ entry={entry}
95
+ showProjectTitle
96
+ showProvider={showProvider}
97
+ {...(environmentLabel !== undefined ? { environmentLabel } : {})}
98
+ matchedElsewhere={
99
+ query.length > 0 && scorePullRequestMatch(entry, query) <= MATCHED_ELSEWHERE_SCORE
100
+ }
101
+ selected={
102
+ selected?.environmentId === entry.environmentId &&
103
+ selected.repository === entry.repository &&
104
+ selected.host?.toLowerCase() === entry.host.toLowerCase() &&
105
+ selected.number === entry.number
106
+ }
107
+ onSelect={onSelect}
108
+ speedMode={speedMode}
109
+ hostActions={hostActionsOf(entry)}
110
+ onActed={onActed}
111
+ closing={closingKeys.has(entryKey)}
112
+ sweeping={sweepingKeys.has(entryKey)}
113
+ onCloseSweepStart={onCloseSweepStart}
114
+ />
115
+ );
116
+ })}
117
+ </div>
118
+ ))}
119
+ </div>
120
+ );
121
+}
apps/web/src/routes/_chat.pull-requests.tsx
+17
-83
@@ -3,7 +3,6 @@ import {
3
parsePullRequestQuery,
4
} from "@t3tools/client-runtime/pull-request-query";
5
import { Spinner } from "~/components/ui/spinner";
6
-import { useShortcutModifierState } from "~/shortcutModifierState";
6
import type { PullRequestSpeedActionResult } from "~/components/pullRequest/PullRequestSpeedActions";
7
import { usePullRequestCloseBatch } from "~/components/pullRequest/usePullRequestActions";
8
import { SidebarPointerSensor } from "~/components/Sidebar.pointer";
@@ -24,15 +23,7 @@ import type {
23
} from "@t3tools/contracts";
24
import { useAtomValue } from "@effect/atom-react";
25
import { createFileRoute, useNavigate } from "@tanstack/react-router";
27
-import {
28
- ArrowDownUpIcon,
29
- EyeIcon,
30
- LayersIcon,
31
- PenLineIcon,
32
- UsersIcon,
33
- Plug2Icon,
34
- type LucideIcon,
35
-} from "lucide-react";
26
+import { ArrowDownUpIcon, LayersIcon, Plug2Icon } from "lucide-react";
27
import { useEffect, useEffectEvent, useRef, useState, type ComponentProps } from "react";
28
29
import {
@@ -58,7 +49,6 @@ import {
49
resolveSelectedEnvironmentId,
50
withDiffStat,
51
writePullRequestListSnapshot,
61
- scorePullRequestMatch,
52
pullRequestStatsRefreshBatches,
53
pullRequestStatsRequestBatches,
54
retainVisiblePullRequestStatsBatches,
@@ -104,12 +94,10 @@ import {
94
STATE_TABS,
95
} from "../components/pullRequest/pullRequestListOptions";
96
import { PullRequestsColumn } from "../components/pullRequest/PullRequestsColumn";
97
+import { PullRequestListGroups } from "../components/pullRequest/PullRequestListGroups";
98
import { PullRequestListEmptyState } from "../components/pullRequest/PullRequestListEmptyState";
99
import { PullRequestListGhost } from "../components/pullRequest/PullRequestGhosts";
109
-import {
110
- PullRequestRow,
111
- type PullRequestRowTarget,
112
-} from "../components/pullRequest/PullRequestRow";
100
+import { type PullRequestRowTarget } from "../components/pullRequest/PullRequestRow";
101
import { PullRequestsUnavailableState } from "../components/pullRequest/PullRequestsUnavailableState";
102
import { RightPanelTabs, type PullRequestTabStatusSeed } from "../components/RightPanelTabs";
103
import { isCommandPaletteOpen } from "../commandPaletteBus";
@@ -151,7 +139,6 @@ import {
139
} from "../state/pullRequests";
140
import { useAtomCommand } from "../state/use-atom-command";
141
import { cn } from "~/lib/utils";
154
-import { Separator } from "~/components/ui/separator";
142
import { primaryServerKeybindingsAtom } from "~/state/server";
143
import { getSourceControlPresentationForKind } from "~/sourceControlPresentation";
144
@@ -178,30 +165,7 @@ export interface PullRequestsSearch extends PullRequestListPreferences {
165
readonly selectedEnvironmentId?: EnvironmentId;
166
}
167
181
-const GROUP_ICONS: Record<string, LucideIcon> = {
182
- authored: PenLineIcon,
183
- reviewRequested: EyeIcon,
184
- others: UsersIcon,
185
-};
186
-
187
-function PullRequestGroupHeader({
188
- group,
189
-}: {
190
- group: { key: string; label: string; entries: ReadonlyArray<unknown> };
191
-}) {
192
- const Icon = GROUP_ICONS[group.key] ?? LayersIcon;
193
- return (
194
- <div className="flex items-center gap-2 px-3 pb-1 text-xs font-medium text-muted-foreground/70">
195
- <Icon aria-hidden className="size-3.5 shrink-0" />
196
- <h2 className="shrink-0">{group.label}</h2>
197
- <span className="shrink-0 tabular-nums text-muted-foreground/50">{group.entries.length}</span>
198
- <Separator className="min-w-2 flex-1" />
199
- </div>
200
- );
201
-}
202
-
168
const SEARCH_DEBOUNCE_MS = 250;
204
-const MATCHED_ELSEWHERE_SCORE = 10;
169
/**
170
* One whole page from the host and no more: every provider asks for one row beyond the page as
171
* its "is there more" probe, and GitHub serves a hundred per request — so asking for ninety-nine
@@ -292,9 +256,6 @@ export const Route = createFileRoute("/_chat/pull-requests")({
256
257
function PullRequestsRouteView() {
258
useEscapeToGoBack();
295
- const modifiers = useShortcutModifierState(true);
296
- const speedMode =
297
- modifiers.shiftKey && !modifiers.metaKey && !modifiers.ctrlKey && !modifiers.altKey;
259
const search = Route.useSearch();
260
const sort = search.sort ?? "ready";
261
const statsPolicy: PullRequestStatsPolicy =
@@ -1302,47 +1263,20 @@ function PullRequestsRouteView() {
1263
onLoadMore={loadMore}
1264
/>
1265
) : (
1305
- <div className={cn("space-y-3", closeSweepKeys.size > 0 && "**:pointer-events-none")}>
1306
- {displayGroups.map((group) => (
1307
- <div key={group.key} className="space-y-0.5">
1308
- {group.label ? <PullRequestGroupHeader group={group} /> : null}
1309
- {group.entries.map((entry) => {
1310
- const entryKey = pullRequestEntryKey(entry);
1311
- return (
1312
- <PullRequestRow
1313
- key={entryKey}
1314
- statsKey={entryKey}
1315
- statsRef={registerStatsRow}
1316
- entry={entry}
1317
- showProjectTitle
1318
- showProvider={showProvider}
1319
- {...(capableEnvironments.length > 1 &&
1320
- environmentLabels.get(entry.environmentId) !== undefined
1321
- ? { environmentLabel: environmentLabels.get(entry.environmentId)! }
1322
- : {})}
1323
- matchedElsewhere={
1324
- typedParsed.text.length > 0 &&
1325
- scorePullRequestMatch(entry, typedParsed.text) <= MATCHED_ELSEWHERE_SCORE
1326
- }
1327
- selected={
1328
- selected?.environmentId === entry.environmentId &&
1329
- selected.repository === entry.repository &&
1330
- selected.host?.toLowerCase() === entry.host.toLowerCase() &&
1331
- selected.number === entry.number
1332
- }
1333
- onSelect={selectEntry}
1334
- speedMode={speedMode}
1335
- hostActions={hostActionsOf(entry)}
1336
- onActed={onSpeedAction}
1337
- closing={closingKeys.has(entryKey)}
1338
- sweeping={closeSweepKeys.has(entryKey)}
1339
- onCloseSweepStart={startCloseSweep}
1340
- />
1341
- );
1342
- })}
1343
- </div>
1344
- ))}
1345
- </div>
1266
+ <PullRequestListGroups
1267
+ groups={displayGroups}
1268
+ environmentLabels={capableEnvironments.length > 1 ? environmentLabels : null}
1269
+ query={typedParsed.text}
1270
+ selected={selected}
1271
+ showProvider={showProvider}
1272
+ statsRef={registerStatsRow}
1273
+ onSelect={selectEntry}
1274
+ hostActionsOf={hostActionsOf}
1275
+ onActed={onSpeedAction}
1276
+ closingKeys={closingKeys}
1277
+ sweepingKeys={closeSweepKeys}
1278
+ onCloseSweepStart={startCloseSweep}
1279
+ />
1280
)}
1281
1282
{listQuery.error && shownCount > 0 ? (