From 628e464b74d7dd6abebdcbc2970feebd37198a06 Mon Sep 17 00:00:00 2001 From: webdevcody Date: Mon, 19 Jan 2026 17:40:46 -0500 Subject: [PATCH] feat: update branch handling and UI components for worktree management - Enhanced branch name determination logic in useBoardActions to ensure features created on non-main worktrees are correctly associated with their respective branches. - Improved DevServerLogsPanel styling for better responsiveness and user experience. - Added event hooks support in settings migration and sync processes to maintain consistency across application state. These changes improve the overall functionality and usability of worktree management within the application. --- .../views/board-view/hooks/use-board-actions.ts | 8 +++++--- .../worktree-panel/components/dev-server-logs-panel.tsx | 4 ++-- apps/ui/src/hooks/use-settings-migration.ts | 3 +++ apps/ui/src/hooks/use-settings-sync.ts | 2 ++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/ui/src/components/views/board-view/hooks/use-board-actions.ts b/apps/ui/src/components/views/board-view/hooks/use-board-actions.ts index fc5a85c2..de9e87ac 100644 --- a/apps/ui/src/components/views/board-view/hooks/use-board-actions.ts +++ b/apps/ui/src/components/views/board-view/hooks/use-board-actions.ts @@ -118,13 +118,14 @@ export function useBoardActions({ const workMode = featureData.workMode || 'current'; // Determine final branch name based on work mode: - // - 'current': Use selected worktree branch if available, otherwise undefined (work on main) + // - 'current': Use current worktree's branch (or undefined if on main) // - 'auto': Auto-generate branch name based on current branch // - 'custom': Use the provided branch name let finalBranchName: string | undefined; if (workMode === 'current') { - // If a worktree is selected, use its branch; otherwise work on main (undefined = no branch assignment) + // Work directly on current branch - use the current worktree's branch if not on main + // This ensures features created on a non-main worktree are associated with that worktree finalBranchName = currentWorktreeBranch || undefined; } else if (workMode === 'auto') { // Auto-generate a branch name based on primary branch (main/master) and timestamp @@ -284,7 +285,8 @@ export function useBoardActions({ let finalBranchName: string | undefined; if (workMode === 'current') { - // If a worktree is selected, use its branch; otherwise work on main (undefined = no branch assignment) + // Work directly on current branch - use the current worktree's branch if not on main + // This ensures features updated on a non-main worktree are associated with that worktree finalBranchName = currentWorktreeBranch || undefined; } else if (workMode === 'auto') { // Auto-generate a branch name based on primary branch (main/master) and timestamp diff --git a/apps/ui/src/components/views/board-view/worktree-panel/components/dev-server-logs-panel.tsx b/apps/ui/src/components/views/board-view/worktree-panel/components/dev-server-logs-panel.tsx index 0e9b5e59..a6d7ef59 100644 --- a/apps/ui/src/components/views/board-view/worktree-panel/components/dev-server-logs-panel.tsx +++ b/apps/ui/src/components/views/board-view/worktree-panel/components/dev-server-logs-panel.tsx @@ -132,12 +132,12 @@ export function DevServerLogsPanel({ return ( !isOpen && onClose()}> {/* Compact Header */} - +
diff --git a/apps/ui/src/hooks/use-settings-migration.ts b/apps/ui/src/hooks/use-settings-migration.ts index 05b8d183..d1daa4bd 100644 --- a/apps/ui/src/hooks/use-settings-migration.ts +++ b/apps/ui/src/hooks/use-settings-migration.ts @@ -730,6 +730,8 @@ export function hydrateStoreFromSettings(settings: GlobalSettings): void { worktreePanelCollapsed: settings.worktreePanelCollapsed ?? false, lastProjectDir: settings.lastProjectDir ?? '', recentFolders: settings.recentFolders ?? [], + // Event hooks + eventHooks: settings.eventHooks ?? [], // Terminal font (nested in terminalState) ...(settings.terminalFontFamily && { terminalState: { @@ -808,6 +810,7 @@ function buildSettingsUpdateFromStore(): Record { lastProjectDir: state.lastProjectDir, recentFolders: state.recentFolders, terminalFontFamily: state.terminalState.fontFamily, + eventHooks: state.eventHooks, }; } diff --git a/apps/ui/src/hooks/use-settings-sync.ts b/apps/ui/src/hooks/use-settings-sync.ts index ef300249..8ede5600 100644 --- a/apps/ui/src/hooks/use-settings-sync.ts +++ b/apps/ui/src/hooks/use-settings-sync.ts @@ -682,6 +682,8 @@ export async function refreshSettingsFromServer(): Promise { worktreePanelCollapsed: serverSettings.worktreePanelCollapsed ?? false, lastProjectDir: serverSettings.lastProjectDir ?? '', recentFolders: serverSettings.recentFolders ?? [], + // Event hooks + eventHooks: serverSettings.eventHooks ?? [], // Terminal settings (nested in terminalState) ...((serverSettings.terminalFontFamily || serverSettings.openTerminalMode) && { terminalState: {