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) {
873873
874874 useEffect(() => {
875875 if (
876 !selectedProjectDraftKey ||
876877 !defaultWorkspaceModeSettled ||
877878 workspaceMode !== "worktree" ||
878879 selectedBranchName !== null
879880 ) {
880881 return;
881882 }
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 }
882890 // The default may only exist as origin/<default> (isRemote), which
883891 // availableBranches filters out — search the unfiltered refs for it.
884892 const preferredBranch =
......@@ -894,6 +902,7 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {
894902 defaultWorkspaceModeSettled,
895903 selectBranch,
896904 selectedBranchName,
905 selectedProjectDraftKey,
897906 workspaceMode,
898907 ]);
899908