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