The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 25, 11:00 UTC
helper
Julius Marminge committed
Mar 3, 2026 at 09:57 UTC
760fe643e857d5b5f9fcd1cb4ceb9fe55df988fc
2 files changed
+21
-5
apps/web/src/components/BranchToolbar.logic.ts
+11
@@ -2,6 +2,17 @@ import type { GitBranch } from "@t3tools/contracts";
2
3
export type EnvMode = "local" | "worktree";
4
5
+export function resolveEffectiveEnvMode(input: {
6
+ activeWorktreePath: string | null;
7
+ hasServerThread: boolean;
8
+ draftThreadEnvMode: EnvMode | undefined;
9
+}): EnvMode {
10
+ const { activeWorktreePath, hasServerThread, draftThreadEnvMode } = input;
11
+ return activeWorktreePath || (!hasServerThread && draftThreadEnvMode === "worktree")
12
+ ? "worktree"
13
+ : "local";
14
+}
15
+
16
export function resolveDraftEnvModeAfterBranchChange(input: {
17
nextWorktreePath: string | null;
18
currentWorktreePath: string | null;
apps/web/src/components/BranchToolbar.tsx
+10
-5
@@ -5,7 +5,11 @@ import { newCommandId } from "../lib/utils";
5
import { readNativeApi } from "../nativeApi";
6
import { useComposerDraftStore } from "../composerDraftStore";
7
import { useStore } from "../store";
8
-import { EnvMode, resolveDraftEnvModeAfterBranchChange } from "./BranchToolbar.logic";
8
+import {
9
+ EnvMode,
10
+ resolveDraftEnvModeAfterBranchChange,
11
+ resolveEffectiveEnvMode,
12
+} from "./BranchToolbar.logic";
13
import { BranchToolbarBranchSelector } from "./BranchToolbarBranchSelector";
14
import { Button } from "./ui/button";
15
@@ -38,10 +42,11 @@ export default function BranchToolbar({
42
const activeWorktreePath = serverThread?.worktreePath ?? draftThread?.worktreePath ?? null;
43
const branchCwd = activeWorktreePath ?? activeProject?.cwd ?? null;
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
+ });
50
51
const setThreadBranch = useCallback(
52
(branch: string | null, worktreePath: string | null) => {