Skip to content

perf(mobile): worktree setup updates commit the thread screen once - #25910

Merged
juliusmarminge merged 1 commit into
mainfrom
effect/split-a2-mobile-worktree-setup-held
Oct 27, 2026
Merged

juliusmarminge merged 1 commit into
mainfrom
effect/split-a2-mobile-worktree-setup-held

Conversation

@juliusmarminge

Copy link
Copy Markdown
Member

Problem

useWorktreeSetup copied each new worktree-setup snapshot into held state from an effect after commit. Its caller, LiveThreadRouteController, is the route-level controller for the whole mobile thread screen, so every setup progress update committed the thread route twice.

Change

The hook now adjusts held during render (if (snapshot && snapshot !== live) setHeld(...)), the same pattern ThreadFeed.tsx and WorkspaceTabsContext.tsx already use. React re-runs the hook before committing. On that pass resolveWorktreeSetupSnapshot returns the held object by identity, so snapshot === live and the update settles. When setup stops running, the query switches to null and the held snapshot keeps showing, as it did before.

What this improves

  • Renders avoided: one commit of the thread route subtree per worktree-setup emission while a new worktree is being prepared.
  • Sync removed: the post-commit copy effect and its react/set-state-in-effect lint disable.
  • No behavior change: the snapshot shown and when the subscription stops are the same as before, one commit earlier. No logging changes.

Effects

  • apps/mobile/src/features/threads/use-worktree-setup.ts: 1 -> 0

Verification

  • vp test run apps/mobile/src/features/threads/worktree-setup-state.test.ts: 4 passed
  • vp run check:changed: format, lint, knip (2/2), typecheck (2 packages), and tests all pass

No regression test: this fixes no bug. It saves a commit, and mobile has no hook-render test harness that could count commits.

Model: Claude Opus 5.5, Claude Code harness.

🤖 Generated with Claude Code

useWorktreeSetup copied each new setup snapshot into held state from an
effect after commit. LiveThreadRouteController, the route-level controller
for the whole thread screen, therefore committed twice for every worktree
setup progress update.

Hold the snapshot by adjusting state during render instead. React re-runs
the hook before committing, and resolveWorktreeSetupSnapshot returns the
held object by identity on that pass, so the update settles after one
commit. The effect and its set-state-in-effect lint disable go away.

Effects: use-worktree-setup.ts 1 -> 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Oct 27, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 8d2261e

Macroscope's review found this PR approvable — This is a small, self-contained mobile performance refactor that preserves worktree setup state and visible behavior while eliminating a redundant thread-screen commit. It introduces no new capability, product-default change, schema change, or broadened static-analysis suppression.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 79f6cd3 and 8d2261e.

Files selected for processing: 1
  • apps/mobile/src/features/threads/use-worktree-setup.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

Walkthrough

useWorktreeSetup now updates held snapshot state during render when a snapshot exists and differs by identity from the live snapshot. It no longer uses useEffect for this retention.

Changes: Snapshot retention

Layer / File(s) Summary
Render-time snapshot retention
apps/mobile/src/features/threads/use-worktree-setup.ts
The hook removes useEffect and updates held snapshot state during render when a snapshot exists and differs by identity from the live snapshot.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Possibly related PRs

  • pingdotgg/t3code#21098: Changes the same hook’s worktree-fork preparation state and passes fork preparation into useWorktreeSetup.
  • pingdotgg/t3code#25119: Adds a lint suppression for the effect that this change removes.

Suggested reviewers: t3dotgg

Merge Risk: Minimal · up to 8d226

No actionable merge-blocking risk remains in the reviewed change.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The description follows the template. It has Problem, Change, and Verification sections with concrete content. The Scope and approval section is missing. The PR description does not link a triaged bug… Add a Scope and approval section. Link the triaged issue or the maintainer discussion with the approval comment. If no prior issue exists, explain why this small, focused perf fix qualifies without prior approval. Optionally, state the tool…
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title names the main change: a perf fix in the mobile worktree setup hook that avoids an extra thread-screen commit. It uses the conventional commit format and matches the raw summary and PR objec…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: a perf fix in the mobile worktree setup hook that avoids an extra thread-screen commit. It uses the conventional commit format and matches the raw summary and PR objectives, which describe moving the held snapshot update into render.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, and Verification sections with concrete content. The Scope and approval section is missing. The PR description does not link a triaged bug issue or maintainer approval, and it does not explain why the change qualifies as a small, focused fix without prior approval. The template calls for that section, and the author does not address it. The description also states that no regression test was added, and gives a reason. The template asks for before/after evidence only for UI changes, which this change does not include.

Resolution

Add a Scope and approval section. Link the triaged issue or the maintainer discussion with the approval comment. If no prior issue exists, explain why this small, focused perf fix qualifies without prior approval. Optionally, state the tooling used for verification with the model and harness, which the template also requests at the end of the Verification section.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@juliusmarminge
juliusmarminge merged commit 0d88fcf into main Oct 27, 2026
30 checks passed
@juliusmarminge
juliusmarminge deleted the effect/split-a2-mobile-worktree-setup-held branch October 27, 2026 12:18
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Oct 27, 2026
## What's Changed
* refactor(mobile): subagent timers share the visible second clock by @juliusmarminge in pingdotgg/t3code#25854
* refactor(mobile): app update checks start with the app by @juliusmarminge in pingdotgg/t3code#25856
* refactor(mobile): workspace tabs, home filters and connection status derive instead of syncing by @juliusmarminge in pingdotgg/t3code#25813
* refactor(mobile): settings permission and update checks without sync effects by @juliusmarminge in pingdotgg/t3code#25895
* fix(desktop): run the packaged bundle self-check on macOS artifacts by @stbenjam in pingdotgg/t3code#25900
* fix(web): the Add ChatGPT account dialog animates closed once the account connects by @juliusmarminge in pingdotgg/t3code#25868
* refactor(web): composer clears scroll-collapse in render, not after paint by @juliusmarminge in pingdotgg/t3code#25909
* refactor(web): composer overlay re-measures from one layout effect by @juliusmarminge in pingdotgg/t3code#25915
* refactor(web): file browser records the right-click position on its own panel by @juliusmarminge in pingdotgg/t3code#25908
* refactor(web): preview element picker drops its unmount guard by @juliusmarminge in pingdotgg/t3code#25920
* fix(web): PR Code tab no longer requests the diff of a commit the PR dropped by @juliusmarminge in pingdotgg/t3code#25916
* perf(mobile): worktree setup updates commit the thread screen once by @juliusmarminge in pingdotgg/t3code#25910
* fix(desktop): a broken release opens an error window instead of hanging by @t3dotgg in pingdotgg/t3code#25903
* ci(web): releases fail when the built web app cannot boot by @t3dotgg in pingdotgg/t3code#25929
* ci(release): desktop builds that cannot open no longer publish by @t3dotgg in pingdotgg/t3code#25928
* refactor(web): file tree drag mentions use React drag handlers by @juliusmarminge in pingdotgg/t3code#25913
* refactor(mobile): git action results buzz from where they are reported by @juliusmarminge in pingdotgg/t3code#25912
* fix(mobile): the Add environment form shows only its own pairing errors by @juliusmarminge in pingdotgg/t3code#25859
* refactor(mobile): showcase capture runs as an app service, not a chain of effects by @juliusmarminge in pingdotgg/t3code#25857
* fix(server): bound hung delegated stop effects so later runs can start by @juliusmarminge in pingdotgg/t3code#25675
* feat(mobile): add One UI navigation preference on Android by @PixPMusic in pingdotgg/t3code#25758


**Full Changelog**: pingdotgg/t3code@v0.1.4-nightly.20261027.3770...v0.1.4-nightly.20261027.3783

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.1.4-nightly.20261027.3783
jieyuexing added a commit to jieyuexing/t3code-zh that referenced this pull request Oct 27, 2026
更新说明(nightly 20261027.3783)

桌面 / 网页
- 桌面发布包损坏时打开错误窗口,不再卡住(pingdotgg#25903)
- macOS 构建产物运行打包内容自检(pingdotgg#25900)
- PR 的 Code 标签不再请求已被 PR 丢弃的提交的差异(pingdotgg#25916)
- 添加 ChatGPT 账户对话框在账户连上后以动画关闭(pingdotgg#25868)

移动端(需更新商店版才有)
- Android 新增 One UI 导航偏好(pingdotgg#25758)
- 「添加环境」表单只显示自身的配对错误(pingdotgg#25859)
- 工作树设置进度只让线程界面提交一次更新(pingdotgg#25910)

服务端与 Agent
- 给挂起的委派停止操作设上限,后续运行可以正常开始(pingdotgg#25675)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant