@devries-cameron20 / t3code-1 / commits / baab17bb03
Fork 0

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

fix(mobile): retrying an issue filter only reloads repositories that failed (#38423)

Co-authored-by: Grok 4.7 <noreply@x.ai> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Wout Stiens committed Nov 18, 2026 at 05:59 UTC baab17bb03aecdb7db11917d64665e7e296514a7
4 files changed +83 -8
apps/mobile/src/state/issues.ts
+3 -2
@@ -37,9 +37,10 @@ const mergedIssueCandidates = createMergedIssueCandidatesAtoms(
37
38 /** The labels and people of every scope a list filter covers; no targets reads nothing. */
39 export function useIssueFilterCandidates(targets: ReadonlyArray<IssueCandidatesTarget>) {
40 - return useAtomValue(mergedIssueCandidates(targets));
40 + return useAtomValue(mergedIssueCandidates.atom(targets));
41 }
42
43 +/** Asks again only the scopes that failed; the ones that answered keep their answer. */
44 export function refreshIssueFilterCandidates(targets: ReadonlyArray<IssueCandidatesTarget>) {
44 - for (const target of targets) appAtomRegistry.refresh(issueEnvironment.candidates(target));
45 + mergedIssueCandidates.retry(appAtomRegistry, targets);
46 }
apps/web/src/state/issues.ts
+1 -1
@@ -42,5 +42,5 @@ const mergedIssueCandidates = createMergedIssueCandidatesAtoms(
42
43 /** The labels and people of every scope a list filter covers; no targets reads nothing. */
44 export function useIssueFilterCandidates(targets: ReadonlyArray<IssueCandidatesTarget>) {
45 - return useAtomValue(mergedIssueCandidates(targets));
45 + return useAtomValue(mergedIssueCandidates.atom(targets));
46 }
packages/client-runtime/src/state/issues.test.ts
+64 -2
@@ -1,7 +1,20 @@
1 -import type { IssueComment, IssueListEntry, IssueTrackerKind, ProjectId } from "@t3tools/contracts";
1 +import {
2 + EnvironmentId,
3 + IssueTrackerKind,
4 + ProjectId,
5 + type IssueComment,
6 + type IssueListEntry,
7 +} from "@t3tools/contracts";
8 +import * as Effect from "effect/Effect";
9 +import { Atom, AtomRegistry } from "effect/reactivity";
10 import { describe, expect, it } from "vite-plus/test";
11
4 -import { issueEntryKey, mergeIssueListPage, prependIssueComments } from "./issues.ts";
12 +import {
13 + createMergedIssueCandidatesAtoms,
14 + issueEntryKey,
15 + mergeIssueListPage,
16 + prependIssueComments,
17 +} from "./issues.ts";
18
19 function entry(overrides: Partial<IssueListEntry> & { key: string }): IssueListEntry {
20 return {
@@ -69,3 +82,52 @@ describe("prependIssueComments", () => {
82 expect(prependIssueComments(current, older).map((c) => c.id)).toEqual(["c1", "c2", "c3", "c4"]);
83 });
84 });
85 +
86 +describe("createMergedIssueCandidatesAtoms", () => {
87 + it("retries only failed scopes that are not already reloading", () => {
88 + const registry = AtomRegistry.make();
89 + const target = (scope: string) => ({
90 + environmentId: EnvironmentId.make("issues"),
91 + input: {
92 + projectId: ProjectId.make(scope),
93 + tracker: IssueTrackerKind.make("github"),
94 + host: "github.com",
95 + scope,
96 + },
97 + });
98 + const targets = [target("acme/healthy"), target("acme/flaky")];
99 + const requests: string[] = [];
100 + const candidates = Atom.family((scope: string) =>
101 + Atom.make(
102 + Effect.suspend(() => {
103 + requests.push(scope);
104 + if (scope === "acme/healthy") {
105 + return Effect.succeed({ labels: [], assignees: [], truncated: false });
106 + }
107 + return requests.length === 2 ? Effect.fail("Repository unavailable") : Effect.never;
108 + }),
109 + ),
110 + );
111 + const merged = createMergedIssueCandidatesAtoms(
112 + (t) => candidates(t.input.scope),
113 + () => "Repository unavailable",
114 + );
115 + const view = merged.atom(targets);
116 + const unmount = registry.mount(view);
117 + try {
118 + expect(registry.get(view)).toMatchObject({
119 + error: "Repository unavailable",
120 + isPending: false,
121 + });
122 +
123 + merged.retry(registry, targets);
124 + expect(registry.get(view).isPending).toBe(true);
125 + merged.retry(registry, targets);
126 +
127 + expect(requests).toEqual(["acme/healthy", "acme/flaky", "acme/flaky"]);
128 + } finally {
129 + unmount();
130 + registry.dispose();
131 + }
132 + });
133 +});
packages/client-runtime/src/state/issues.ts
+15 -3
@@ -260,7 +260,10 @@ const NO_ISSUE_CANDIDATES: MergedIssueCandidates = {
260 truncated: false,
261 };
262
263 -/** Fans out like the merged listing: a scope that fails leaves the others' answers in place. */
263 +/**
264 + * Fans out like the merged listing: a scope that fails leaves the others' answers in place.
265 + * Retry skips scopes that already answered or still have a request in flight.
266 + */
267 export function createMergedIssueCandidatesAtoms<E>(
268 candidates: (
269 target: IssueCandidatesTarget,
@@ -296,6 +299,15 @@ export function createMergedIssueCandidatesAtoms<E>(
299 };
300 }).pipe(Atom.withLabel(`issues:candidates:${key}`)),
301 );
299 - return (targets: ReadonlyArray<IssueCandidatesTarget>) =>
300 - targets.length === 0 ? empty : family(JSON.stringify(targets));
302 + return {
303 + atom: (targets: ReadonlyArray<IssueCandidatesTarget>) =>
304 + targets.length === 0 ? empty : family(JSON.stringify(targets)),
305 + retry: (registry: AtomRegistry.AtomRegistry, targets: ReadonlyArray<IssueCandidatesTarget>) => {
306 + for (const target of targets) {
307 + const atom = candidates(target);
308 + const result = registry.get(atom);
309 + if (result._tag === "Failure" && !result.waiting) registry.refresh(atom);
310 + }
311 + },
312 + };
313 }