| @@ -5,7 +5,11 @@ import { newCommandId } from "../lib/utils"; · 4 unmodified lines |
| 5 | 5 | import { readNativeApi } from "../nativeApi"; |
| 6 | 6 | import { useComposerDraftStore } from "../composerDraftStore"; |
| 7 | 7 | import { useStore } from "../store"; |
| 8 | | −import { EnvMode, resolveDraftEnvModeAfterBranchChange } from "./BranchToolbar.logic"; |
| 8 | +import { |
| 9 | + EnvMode, |
| 10 | + resolveDraftEnvModeAfterBranchChange, |
| 11 | + resolveEffectiveEnvMode, |
| 12 | +} from "./BranchToolbar.logic"; |
| 9 | 13 | import { BranchToolbarBranchSelector } from "./BranchToolbarBranchSelector"; |
| 10 | 14 | import { Button } from "./ui/button"; |
| 11 | 15 | |
| @@ -38,10 +42,11 @@ export default function BranchToolbar({ · 26 unmodified lines |
| 38 | 42 | const activeWorktreePath = serverThread?.worktreePath ?? draftThread?.worktreePath ?? null; |
| 39 | 43 | const branchCwd = activeWorktreePath ?? activeProject?.cwd ?? null; |
| 40 | 44 | const hasServerThread = serverThread !== undefined; |
| 41 | | − const effectiveEnvMode: EnvMode = |
| 42 | | − activeWorktreePath || (!hasServerThread && draftThread?.envMode === "worktree") |
| 43 | | − ? "worktree" |
| 44 | | − : envMode; |
| 45 | + const effectiveEnvMode = resolveEffectiveEnvMode({ |
| 46 | + activeWorktreePath, |
| 47 | + hasServerThread, |
| 48 | + draftThreadEnvMode: draftThread?.envMode, |
| 49 | + }); |
| 45 | 50 | |
| 46 | 51 | const setThreadBranch = useCallback( |
| 47 | 52 | (branch: string | null, worktreePath: string | null) => { |