GeezerVison is showing github.com — perf(mobile): worktree setup updates commit the thread screen once by juliusmarminge · Pull Request #25910 · pingdotgg/t3code
Conversation
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
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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 <[email protected]>
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|

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
Suggested reviewers: t3dotgg
Merge Risk: Minimal · up to 8d226
-
No actionable merge-blocking risk remains in the reviewed change.
Pre-merge checks: 3 · 1
-
Failed checks: 1 warning
| Check name |
Status |
Explanation |
Resolution |
| Description check |
 |
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 checks: 3 passed
-
| Check name |
Status |
Explanation |
| Title check |
 |
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 |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:XS
0-9 changed lines (additions + deletions).
vouch:trusted
Author is trusted by repo permissions or the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|