Skip to content

Commit e0d5f88

Browse files
committed
fix(web): starting a worktree thread no longer resets it to the base branch
1 parent ade9163 commit e0d5f88

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎apps/web/src/components/BranchToolbarBranchSelector.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,13 @@ export function BranchToolbarBranchSelector({
538538
? null
539539
: (defaultBranchName ?? currentGitBranch);
540540

541+
// A started thread's server is creating its worktree and records the branch
542+
// itself; defaulting it here would reset the thread to the base checkout and
543+
// detach the agent that just started.
544+
const threadStarted = serverSession !== null;
541545
useEffect(() => {
542546
if (
547+
threadStarted ||
543548
effectiveEnvMode !== "worktree" ||
544549
activeWorktreePath ||
545550
activeThreadBranch ||
@@ -553,6 +558,7 @@ export function BranchToolbarBranchSelector({
553558
activeWorktreePath,
554559
effectiveEnvMode,
555560
setThreadBranch,
561+
threadStarted,
556562
worktreeBaseBranchCandidate,
557563
]);
558564

0 commit comments

Comments
 (0)