Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): worktree setup clock pauses on hidden thread screens #17701

Closedbompus(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/17701/headopened View on GitHub

A hidden mobile thread screen no longer re-renders every second for the worktree setup card and the "Working for" label.

Problem

Mobile keeps a thread route mounted when you push another route over it (Files, Review, Terminal). The worktree setup card and the "Working for" header above it kept a 1 s interval running while the thread screen was hidden, so the hidden screen re-rendered every second until the app went to the background. #15397 stopped the same behavior for the working timer and the subagent bar; these two labels were not covered.

Change

worktree-setup-card.tsx now uses the existing useVisibleSecondClock instead of its own clock. The clock ticks only while the label is live, the screen is focused and the app is active, and it re-reads the time when ticking resumes, so a label does not show the moment it paused. The local useSetupClock is deleted (+5/−19 lines, one file). Nothing changes while the screen is visible.

Scope and approval

Very small, focused fix. It applies the hook that #15397 added for the sibling timers to the two labels that were missed. No new setting, wire field or behavior while the screen is visible.

Fixes #18922.

Verification

  • In apps/mobile: tsc --noEmit exits 0, and formatting and lint on the changed file pass.
  • vp test run src/features/threads: 331 tests pass. No test mounts the card itself. The gating and the re-read on resume are covered by the hook's own tests from #15397.
  • Not run on a device or simulator, and I did not measure render counts for these two labels. The 60 → 0 renders per minute on a hidden screen in #15397 is that PR's measurement of the same hook, not a result for this change.

Claude Sonnet 5.5, run through Claude Code.

Closes #18922

    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at d8c9255

      Macroscope's review found this PR approvable — This is a narrowly scoped mobile bug fix that reuses an existing, tested visibility-aware clock for two elapsed-time labels. Visible behavior remains unchanged while hidden thread screens stop re-rendering every second, with no schema, configuration, or deployment impact.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      Important

      Review skipped

      Review was skipped as selected files did not have any reviewable changes.

      ⚙️ Run configuration
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 6afa8af5-aa70-4474-8c3b-3c6002a9c88f
      📥 Commits

      Reviewing files that changed from the base of the PR and between d8c92551589f204913cd9c427a4cad2458ddf64b and 7962085c8a014974e2ab77903bcdd1d716683d47.

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Path: .coderabbit.config.ts
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: a0d4cf5c-a1fb-4d59-9eab-a635be37cd38
      📥 Commits

      Reviewing files that changed from the base of the PR and between bae3403554eeb40125a2c9412c30415548358e6a and d8c92551589f204913cd9c427a4cad2458ddf64b.

      📒 Files selected for processing (1)
      • apps/mobile/src/features/threads/worktree-setup-card.tsx

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

      📝 Walkthrough
      📝 Walkthrough

      Walkthrough

      WorktreeSetupCard and WorktreeWorkingHeader now use useVisibleSecondClock. The file-local useSetupClock hook and its useEffect and AppState imports were removed.

      Changes

      Worktree clock

      Layer / File(s)Summary
      Adopt the shared visible-second clock
      apps/mobile/src/features/threads/worktree-setup-card.tsx
      Both components now get their current time from useVisibleSecondClock. The file-local useSetupClock hook and its related imports were removed.

      Priority: ⬇️ Low

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

      Change: Bug fix · Severity of issue fixed: Low

      Suggested reviewers: juliusmarminge

      Merge Risk: ⚪ Minimal · up to d8c92

      Elapsed-time displays continue updating while visible and active, catch up when resumed, and pause while hidden or inactive. No actionable merge-blocking risk remains.

      Pre-merge checks: Passed 4
      Passed Passed checks (4 passed)
      Check nameStatusExplanation
      Linked Issues checkPassedIssue #18160 requires the worktree setup card and the "Working for" label to stop per-second work when a mobile thread screen is hidden. WorktreeSetupCard now uses `useVisibleSecondClock(running || …
      Out of Scope Changes checkPassedThe change is limited to apps/mobile/src/features/threads/worktree-setup-card.tsx. It removes the local interval clock and applies the existing visibility-aware clock to the two labels identified by…
      Title checkPassedThe title is concise, conventional, and accurately describes the main fix: pausing the worktree setup clock on hidden mobile thread screens.
      Description checkPassedThe description completes all required sections. It clearly explains the problem, change, scope, approval basis, verification results, and testing limitations. It does not include the template-request…
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • 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.
    4. juliusmarminge added labelsmacroscope-review

    5. Note

      Written by gpt-6.1-sol on behalf of Maria

      Thanks for identifying the remaining hidden-screen timers. This PR replaces the setup clock with the visibility hook, but it has no device verification or render-count measurement for the affected labels. Right now we are only taking focused bug fixes from outside contributors under our limited review capacity: https://github.com/pingdotgg/t3code/blob/main/CONTRIBUTING.md#read-this-first. Please keep #18922 as the problem report and request reconsideration with before/after measurements through the mobile navigation flow and a check that elapsed labels catch up on return.

    6. maria-rcks closed this

    7. juliusmarminge assignedjuliusmarminge

    8. Note

      Claude Opus 5.5 responding on behalf of Julius.

      Taking over this one. Maintainer edits are off on this branch, so I will rebuild it on current main in a replacement PR from this repo, keeping your commits and crediting you, and link it here.

    9. Note

      Claude Opus 5.5 responding on behalf of Julius.

      Thanks @bompus, this was the right fix as you wrote it. It is now #20066 unchanged, with your commit and credit. Both reviewers traced every render site and found nothing to change.

Sign in to join this conversation.