From 99fe6f6497033a837301c1bd2f98767fce3cee2d Mon Sep 17 00:00:00 2001 From: Cody Seibert Date: Wed, 17 Dec 2025 23:38:19 -0500 Subject: [PATCH] refactor: clarify branch name handling in feature dialogs - Updated comments in AddFeatureDialog and EditFeatureDialog to better explain the logic for determining the final branch name based on the current worktree context. - Adjusted logic to ensure that an empty string indicates "unassigned" for primary worktrees, while allowing for the use of the current branch when applicable. - Simplified branch name handling in useBoardActions to reflect these changes. --- .../views/board-view/dialogs/add-feature-dialog.tsx | 7 ++++--- .../views/board-view/dialogs/edit-feature-dialog.tsx | 7 ++++--- .../components/views/board-view/hooks/use-board-actions.ts | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/app/src/components/views/board-view/dialogs/add-feature-dialog.tsx b/apps/app/src/components/views/board-view/dialogs/add-feature-dialog.tsx index 3800a751..51dfd4bd 100644 --- a/apps/app/src/components/views/board-view/dialogs/add-feature-dialog.tsx +++ b/apps/app/src/components/views/board-view/dialogs/add-feature-dialog.tsx @@ -153,10 +153,11 @@ export function AddFeatureDialog({ ? newFeature.thinkingLevel : "none"; - // Use current branch if toggle is on (empty string = use current), otherwise use selected branch - // Important: Don't save the actual current branch name - empty string means "use current" + // Use current branch if toggle is on + // If currentBranch is provided (non-primary worktree), use it + // Otherwise (primary worktree), use empty string which means "unassigned" (show only on primary) const finalBranchName = useCurrentBranch - ? "" + ? (currentBranch || "") : newFeature.branchName || ""; onAdd({ diff --git a/apps/app/src/components/views/board-view/dialogs/edit-feature-dialog.tsx b/apps/app/src/components/views/board-view/dialogs/edit-feature-dialog.tsx index dcc5dd98..56d2757b 100644 --- a/apps/app/src/components/views/board-view/dialogs/edit-feature-dialog.tsx +++ b/apps/app/src/components/views/board-view/dialogs/edit-feature-dialog.tsx @@ -150,10 +150,11 @@ export function EditFeatureDialog({ ? editingFeature.thinkingLevel ?? "none" : "none"; - // Use current branch if toggle is on (empty string = use current), otherwise use selected branch - // Important: Don't save the actual current branch name - empty string means "use current" + // Use current branch if toggle is on + // If currentBranch is provided (non-primary worktree), use it + // Otherwise (primary worktree), use empty string which means "unassigned" (show only on primary) const finalBranchName = useCurrentBranch - ? "" + ? (currentBranch || "") : editingFeature.branchName || ""; const updates = { diff --git a/apps/app/src/components/views/board-view/hooks/use-board-actions.ts b/apps/app/src/components/views/board-view/hooks/use-board-actions.ts index 68d986f8..9deb8a40 100644 --- a/apps/app/src/components/views/board-view/hooks/use-board-actions.ts +++ b/apps/app/src/components/views/board-view/hooks/use-board-actions.ts @@ -102,7 +102,8 @@ export function useBoardActions({ }) => { // Simplified: Only store branchName, no worktree creation on add // Worktrees are created at execution time (when feature starts) - // Empty string means user chose "use current branch" - don't save a branch name + // Empty string means "unassigned" (show only on primary worktree) - convert to undefined + // Non-empty string is the actual branch name (for non-primary worktrees) const finalBranchName = featureData.branchName || undefined; const newFeatureData = {