The best way to control Claude Code, Codex and more from any computer or phone
perf(mobile): worktree setup updates commit the thread screen once (#25910)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 27, 2026 at 05:17 UTC
0d88fcf3d541ed986a856a5e4eabdff433ad156b
1 file changed
+5
-5
apps/mobile/src/features/threads/use-worktree-setup.ts
+5
-5
@@ -1,6 +1,6 @@
1
import type { EnvironmentId, ThreadId, WorktreeSetupSnapshot } from "@t3tools/contracts";
2
import { resolveVisibleWorktreeSetup } from "@t3tools/client-runtime/worktree-setup";
3
-import { useEffect, useState } from "react";
3
+import { useState } from "react";
4
import { useEnvironmentQuery } from "../../state/query";
5
import { vcsEnvironment } from "../../state/vcs";
6
import { resolveWorktreeSetupSnapshot } from "./worktree-setup-state";
@@ -26,10 +26,10 @@ export function useWorktreeSetup(input: {
26
: null,
27
);
28
const snapshot = resolveWorktreeSetupSnapshot(input.threadId, query.data, live);
29
- useEffect(() => {
30
- // oxlint-disable-next-line react/set-state-in-effect -- Holds the last setup snapshot while the live subscription changes over.
31
- if (snapshot && snapshot !== live) setHeld({ key, snapshot });
32
- }, [key, live, snapshot]);
29
+ // Hold the newest snapshot so it survives the subscription closing once setup stops running.
30
+ // Set during render so each emission commits once; the resolver returns `live` by identity
31
+ // on the next pass, which ends the update.
32
+ if (snapshot && snapshot !== live) setHeld({ key, snapshot });
33
return {
34
snapshot,
35
visible: resolveVisibleWorktreeSetup({