From 0f43ab02e63c837f07e4e8eb5576a47921cad644 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sun, 19 Apr 2026 00:13:54 -0700 Subject: [PATCH] fix(sidebar): drop top margin on first worktree group header (#824) The worktree search bar already provides spacing above the list, so the first group header doesn't need its own mt-2 offset. Secondary headers still get the margin to separate groups. --- src/renderer/src/components/sidebar/WorktreeList.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/renderer/src/components/sidebar/WorktreeList.tsx b/src/renderer/src/components/sidebar/WorktreeList.tsx index a1f6ba432..e2f9ae9ea 100644 --- a/src/renderer/src/components/sidebar/WorktreeList.tsx +++ b/src/renderer/src/components/sidebar/WorktreeList.tsx @@ -235,6 +235,8 @@ const VirtualizedWorktreeViewport = React.memo(function VirtualizedWorktreeViewp [navigateWorktree] ) + const firstHeaderIndex = useMemo(() => rows.findIndex((r) => r.type === 'header'), [rows]) + const virtualItems = virtualizer.getVirtualItems() const activeDescendantId = activeWorktreeId != null && @@ -291,7 +293,11 @@ const VirtualizedWorktreeViewport = React.memo(function VirtualizedWorktreeViewp role="button" tabIndex={0} className={cn( - 'group mt-2 flex h-7 w-full items-center gap-1.5 px-1.5 text-left transition-all cursor-pointer', + 'group flex h-7 w-full items-center gap-1.5 px-1.5 text-left transition-all cursor-pointer', + // First header sits right under the sidebar search bar, which + // already supplies its own spacing — only offset secondary + // group headers. + vItem.index !== firstHeaderIndex && 'mt-2', row.repo ? 'overflow-hidden' : row.tone )} onClick={() => toggleGroup(row.key)}