The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 11:00 UTC
perf(web): resting on a PR row also reads its activity, so the timeline shows on click (#32842)
Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: GPT-6.1 Sol <noreply@openai.com> Co-authored-by: Shivam Sharma <91240327+shivamhwp@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Bilal Bakr committed
Nov 15, 2026 at 09:30 UTC
238678951ac4945969b8203ae2996b5891b6ffce
2 files changed
+27
-21
apps/web/src/components/pullRequest/usePullRequestIntentPrefetch.browser.test.tsx
+13
-14
@@ -9,6 +9,7 @@ vi.mock(import("~/state/pullRequests"), async (original) => {
9
pullRequestEnvironment: {
10
...actual.pullRequestEnvironment,
11
detail: ((target: unknown) => target) as never,
12
+ activity: ((target: unknown) => ({ activity: target })) as never,
13
},
14
};
15
});
@@ -46,7 +47,7 @@ function Rows() {
47
);
48
}
49
49
-it("reads the panel's detail once intent rests on a row for 150 ms", async () => {
50
+it("reads the panel's detail and activity once intent rests on a row for 150 ms", async () => {
51
state.reads = [];
52
await using screen = await render(<Rows />, {
53
// A bare hook probe; nothing here navigates.
@@ -68,19 +69,17 @@ it("reads the panel's detail once intent rests on a row for 150 ms", async () =>
69
expect(state.reads).toEqual([]);
70
await act(() => vi.advanceTimersByTime(1));
71
// Query atoms key on JSON order: this is the order the PRs page panel reads.
71
- expect(JSON.stringify(state.reads.at(-1))).toBe(
72
- JSON.stringify({
73
- environmentId,
74
- input: {
75
- projectId: row.projectId,
76
- repository: "owner/repo",
77
- number: 7,
78
- host: "github.com",
79
- allowStale: false,
80
- },
81
- }),
82
- );
72
+ const reference = {
73
+ projectId: row.projectId,
74
+ repository: "owner/repo",
75
+ number: 7,
76
+ host: "github.com",
77
+ };
78
+ expect(state.reads.slice(-2).map((read) => JSON.stringify(read))).toEqual([
79
+ JSON.stringify({ environmentId, input: { ...reference, allowStale: false } }),
80
+ JSON.stringify({ activity: { environmentId, input: reference } }),
81
+ ]);
82
83
await act(() => leave.click());
85
- expect(state.reads.at(-1)).toBeNull();
84
+ expect(state.reads.slice(-2)).toEqual([null, null]);
85
});
apps/web/src/components/pullRequest/usePullRequestIntentPrefetch.ts
+14
-7
@@ -18,8 +18,9 @@ interface PullRequestIntentTarget {
18
}
19
20
/**
21
- * Reads the detail a row's panel will ask for once the pointer or focus rests on it, so the
22
- * click paints from it. Passing over rows asks the host nothing, and leaving a row stops reading it.
21
+ * Reads the detail and activity a row's panel will ask for once the pointer or focus rests on it,
22
+ * so the click paints from them. Passing over rows asks the host nothing, and leaving a row stops
23
+ * reading it.
24
*/
25
export function usePullRequestIntentPrefetch(
26
isListed: (target: PullRequestIntentTarget) => boolean,
@@ -29,17 +30,23 @@ export function usePullRequestIntentPrefetch(
30
// A removed row fires no leave event.
31
const listed = target !== null && isListed(target);
32
if (target !== null && !listed) setTarget(null);
32
- useEnvironmentQuery(
33
+ const reference =
34
target === null || !listed
35
+ ? null
36
+ : pullRequestPanelReference({ ...target, host: target.host.toLowerCase() });
37
+ useEnvironmentQuery(
38
+ target === null || reference === null
39
? null
40
: pullRequestEnvironment.detail({
41
environmentId: target.environmentId,
37
- input: {
38
- ...pullRequestPanelReference({ ...target, host: target.host.toLowerCase() }),
39
- allowStale: false,
40
- },
42
+ input: { ...reference, allowStale: false },
43
}),
44
);
45
+ useEnvironmentQuery(
46
+ target === null || reference === null
47
+ ? null
48
+ : pullRequestEnvironment.activity({ environmentId: target.environmentId, input: reference }),
49
+ );
50
return useStableCallback((next: PullRequestIntentTarget | null) => {
51
clearTimeout(timer.current);
52
if (next === null) {