Skip to content

fix(mobile): use loaded branch for untouched worktree base - #23241

Merged
maria-rcks merged 6 commits into
pingdotgg:mainfrom
only21mil:r13/a083-seed-the-worktree-base-after-branch-stat
Nov 1, 2026
Merged

maria-rcks merged 6 commits into
pingdotgg:mainfrom
only21mil:r13/a083-seed-the-worktree-base-after-branch-stat

Conversation

@only21mil

@only21mil only21mil commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On mobile, opening Branches & worktrees before Git status loads can leave the new worktree's base set to main, even after status reports release/stable. Stale thread metadata can leave an old branch in the field instead. Creating the worktree then uses the wrong base or fails if that ref does not exist.

Change

Keep only the user's edit in state. Until the field is edited, derive its value from the current branch so a status response updates the default. Once edited, preserve the entered value, including an empty field.

Scope and approval

This is a very small, focused fix for an obvious bug, under the exception in CONTRIBUTING.md: the sheet's default ignores Git status that arrives after it opens. It changes no product default and no other branch-selection flow. No issue or maintainer approval is claimed. It affects the shared iOS and Android sheet. Branch selection elsewhere is unchanged.

Verification

  • cd apps/mobile && pnpm exec vp test run --project react src/features/threads/git/GitBranchesSheet.test.tsx: base production source fails two cases by submitting main or stale metadata. Candidate passes all four, including edited and cleared input. No timers or polling. This re-adds the sheet test path that test: delete 11k low-signal tests so CI runs faster and flakes less #22557 pruned; it now covers only the late-status default and its edit-preserving counterpart.
  • pnpm --filter @t3tools/mobile typecheck passes. Targeted pnpm exec vp lint and pnpm exec vp fmt --check pass on the sheet, test and mobile test configuration.
  • iOS 26.5 and Android 16.0, fresh isolated state, matching Debug native clients with production JavaScript: pause the owned backend while opening the sheet, then resume it. Base retains main; candidate uses release/stable. Both candidates create a worktree through the UI, and Git confirms its branch starts at the release/stable commit. An edited base also keeps its value after status resumes. Device runs and services were cleaned up.

Not checked:

  • Physical devices and distributed/store builds.

The base retains main alongside the checked-out release/stable branch.

iOS base retains main

Android base retains main

The candidate's untouched base follows the loaded branch.

iOS candidate uses release/stable

Android candidate uses release/stable

Edited bases remain entered: master on iOS and custom-base on Android.

iOS edited base shows master

Android edited base shows custom-base

The regression fails on the base and passes on the candidate.

Regression fails on base

Regression passes on candidate

Prior PRs: Jacob's open #20754 changes jj terminology in this sheet and keeps its one-time base initialization, so it does not fix this stale default; it also rewrites the same initializer lines, so whichever lands second needs a small rebase. Julius Marminge's #22980 and Alex's #22551 change this sheet's header and layout only. This patch reuses no code from them.

Generated with GPT-6.1 Sol in T3 Code Nightly

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants