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 <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]>
This commit is contained in:
1 file changed
+9
@@ -873,12 +873,20 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
!selectedProjectDraftKey ||
|
||||
!defaultWorkspaceModeSettled ||
|
||||
workspaceMode !== "worktree" ||
|
||||
selectedBranchName !== null
|
||||
) {
|
||||
return;
|
||||
}
|
||||
// The draft screen writes a thread's branch and worktree into the draft in
|
||||
// the same commit this effect runs, so the rendered selection above can be
|
||||
// stale. Re-read the draft before replacing it.
|
||||
const live = getComposerDraftSnapshot(selectedProjectDraftKey).workspaceSelection;
|
||||
if (live && (live.mode !== "worktree" || live.branch !== null)) {
|
||||
return;
|
||||
}
|
||||
// The default may only exist as origin/<default> (isRemote), which
|
||||
// availableBranches filters out — search the unfiltered refs for it.
|
||||
const preferredBranch =
|
||||
@@ -894,6 +902,7 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {
|
||||
defaultWorkspaceModeSettled,
|
||||
selectBranch,
|
||||
selectedBranchName,
|
||||
selectedProjectDraftKey,
|
||||
workspaceMode,
|
||||
]);
|
||||
|
||||
|
||||
Reference in new issue
Block a user