@devries-cameron20 / t3code Mirror · read-only / commits / 70eeb3996d
Fork 0

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, 18:00 UTC

fix(mobile): stop refreshing Git status on streamed thread updates (#15893)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Julius Marminge committed Oct 7, 2026 at 22:48 UTC 70eeb3996d557a2e553f817c8e123bf79bbd378c
2 files changed +19 -4
apps/mobile/src/state/use-selected-thread-git-actions.test.ts
+1
@@ -26,6 +26,7 @@ vi.mock("react", () => ({
26 useCallback: (callback: unknown) => callback,
27 useMemo: (factory: () => unknown) => factory(),
28 useEffect: () => {},
29 + useEffectEvent: (callback: unknown) => callback,
30 }));
31 vi.mock("./session", () => ({
32 useEnvironmentScope: (environmentId: unknown, scope: string) =>
apps/mobile/src/state/use-selected-thread-git-actions.ts
+18 -4
@@ -1,4 +1,4 @@
1 -import { useCallback, useEffect, useMemo } from "react";
1 +import { useCallback, useEffect, useEffectEvent, useMemo } from "react";
2
3 import { EnvironmentProject, EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
4 import type { AtomCommandResult } from "@t3tools/client-runtime/state/runtime";
@@ -140,12 +140,26 @@ export function useSelectedThreadGitActions() {
140 [refreshStatus, selectedThread, selectedThreadCwd, selectedThreadProject],
141 );
142
143 + // Shell updates replace the selected thread object many times per second while a
144 + // turn streams, so key the refresh on primitives. The server publishes status after
145 + // each turn finishes; this only seeds status when the selection or cwd changes.
146 + const selectedEnvironmentId = selectedThread?.environmentId ?? null;
147 + const selectedThreadId = selectedThread?.id ?? null;
148 + const hasSelectedThreadProject = selectedThreadProject !== null;
149 + const refreshOnSelection = useEffectEvent(() => {
150 + void refreshSelectedThreadGitStatus({ quiet: true });
151 + });
152 useEffect(() => {
144 - if (!selectedThread || !selectedThreadProject) {
153 + if (
154 + selectedEnvironmentId === null ||
155 + selectedThreadId === null ||
156 + !hasSelectedThreadProject ||
157 + selectedThreadCwd === null
158 + ) {
159 return;
160 }
147 - void refreshSelectedThreadGitStatus({ quiet: true });
148 - }, [refreshSelectedThreadGitStatus, selectedThread, selectedThreadProject]);
161 + refreshOnSelection();
162 + }, [selectedEnvironmentId, selectedThreadId, hasSelectedThreadProject, selectedThreadCwd]);
163
164 const runSelectedThreadGitMutation = useCallback(
165 async <T, E>(