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 23, 13:00 UTC
fix(prs): bound refreshes by each tracker read (#19403)
Bilal Bakr committed
Oct 15, 2026 at 19:24 UTC
98bc998e73ad823cc15df6f110fedec10261a5bc
3 files changed
+38
-1
apps/web/src/components/pullRequest/pullRequestList.logic.test.ts
+22
@@ -9,6 +9,7 @@ import { describe, expect, it } from "vite-plus/test";
9
10
import {
11
pullRequestHostActions,
12
+ largestPullRequestReadCount,
13
pullRequestQuickActions,
14
filterPullRequestsByInvolvement,
15
findScopedProject,
@@ -1759,3 +1760,24 @@ describe("pull request quick actions", () => {
1760
]);
1761
});
1762
});
1763
+
1764
+describe("refresh page size", () => {
1765
+ const twoPagesAcrossFourRepositories = (provider: "github" | "gitlab") =>
1766
+ ["a", "b", "c", "d"].flatMap((name) =>
1767
+ Array.from({ length: 198 }, (_, index) =>
1768
+ entry({
1769
+ number: index + 1,
1770
+ provider: SourceControlProviderKind.make(provider),
1771
+ repository: `pingdotgg/${name}`,
1772
+ }),
1773
+ ),
1774
+ );
1775
+
1776
+ it("asks each repository for its own rows where repositories are read one at a time", () => {
1777
+ expect(largestPullRequestReadCount(twoPagesAcrossFourRepositories("gitlab"))).toBe(198);
1778
+ });
1779
+
1780
+ it("asks for the whole host where one search reads every repository", () => {
1781
+ expect(largestPullRequestReadCount(twoPagesAcrossFourRepositories("github"))).toBe(792);
1782
+ });
1783
+});
apps/web/src/components/pullRequest/pullRequestList.logic.ts
+13
@@ -1304,3 +1304,16 @@ export function pullRequestQuickActions(
1304
: ["close", "merge"];
1305
return forState.filter((action) => hostActions.has(action));
1306
}
1307
+
1308
+export function largestPullRequestReadCount(
1309
+ entries: ReadonlyArray<EnvironmentPullRequestEntry>,
1310
+): number {
1311
+ const counts = new Map<string, number>();
1312
+ for (const entry of entries) {
1313
+ const read = `${entry.environmentId} ${entry.host.toLowerCase()} ${
1314
+ entry.provider === "github" ? "" : entry.repository.toLowerCase()
1315
+ }`;
1316
+ counts.set(read, (counts.get(read) ?? 0) + 1);
1317
+ }
1318
+ return Math.max(0, ...counts.values());
1319
+}
apps/web/src/routes/_chat.pull-requests.tsx
+3
-1
@@ -91,6 +91,7 @@ import {
91
reusePullRequestEntries,
92
settlePullRequestOverrides,
93
pullRequestHostActions,
94
+ largestPullRequestReadCount,
95
} from "../components/pullRequest/pullRequestList.logic";
96
import {
97
pullRequestListPreferences,
@@ -1238,7 +1239,8 @@ function PullRequestsRouteView() {
1239
return;
1240
}
1241
if (related.length > 0) listQuery.refresh(related);
1241
- const loadedCount = ordered?.key === filterKey ? ordered.entries.length : pageSize;
1242
+ const loadedCount =
1243
+ ordered?.key === filterKey ? largestPullRequestReadCount(ordered.entries) : pageSize;
1244
setPage({
1245
key: filterKey,
1246
regrown: [],