authorgravatar for 76637177+SunkenInTime@users.noreply.github.comDara Adedeji <76637177+SunkenInTime@users.noreply.github.com> 2026-09-21 00:09:06-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-20 21:09:06-07:00
loga6cb1dd2054c96c5be41980e63594ea51554a552
treee5c9de69918a704d50d9dd489311e6528a30adda
parenta4bc7deb992cc3d48dd4a40ee1f84254f190f318
signature Signed by PGP key B5690EEEBB952194

fix(mobile): keep the source worktree when starting a thread on a branch (#12623)

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

1 files changed, 9 insertions(+), 0 deletions(-)

apps/mobile/src/features/threads/new-task-flow-provider.tsx+9
...@@ -873,12 +873,20 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {...@@ -873,12 +873,20 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {
873873
874 useEffect(() => {874 useEffect(() => {
875 if (875 if (
876 !selectedProjectDraftKey ||
876 !defaultWorkspaceModeSettled ||877 !defaultWorkspaceModeSettled ||
877 workspaceMode !== "worktree" ||878 workspaceMode !== "worktree" ||
878 selectedBranchName !== null879 selectedBranchName !== null
879 ) {880 ) {
880 return;881 return;
881 }882 }
883 // The draft screen writes a thread's branch and worktree into the draft in
884 // the same commit this effect runs, so the rendered selection above can be
885 // stale. Re-read the draft before replacing it.
886 const live = getComposerDraftSnapshot(selectedProjectDraftKey).workspaceSelection;
887 if (live && (live.mode !== "worktree" || live.branch !== null)) {
888 return;
889 }
882 // The default may only exist as origin/<default> (isRemote), which890 // The default may only exist as origin/<default> (isRemote), which
883 // availableBranches filters out — search the unfiltered refs for it.891 // availableBranches filters out — search the unfiltered refs for it.
884 const preferredBranch =892 const preferredBranch =
...@@ -894,6 +902,7 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {...@@ -894,6 +902,7 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {
894 defaultWorkspaceModeSettled,902 defaultWorkspaceModeSettled,
895 selectBranch,903 selectBranch,
896 selectedBranchName,904 selectedBranchName,
905 selectedProjectDraftKey,
897 workspaceMode,906 workspaceMode,
898 ]);907 ]);
899908