From 4b976141e0ab6c540d9f4c268c85d06cb7277808 Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Wed, 29 Jul 2026 18:56:22 +0300 Subject: [PATCH] fix(ui): back recent header only when stuck --- .../src/components/session/SessionSidebar.tsx | 3 +- .../sidebar/SidebarActivitySections.tsx | 19 ++++++++++-- .../sidebar/hooks/useStickyProjectHeaders.ts | 31 +++++++++++++++++++ 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/packages/ui/src/components/session/SessionSidebar.tsx b/packages/ui/src/components/session/SessionSidebar.tsx index a81ed98e..4b57be67 100644 --- a/packages/ui/src/components/session/SessionSidebar.tsx +++ b/packages/ui/src/components/session/SessionSidebar.tsx @@ -1705,9 +1705,10 @@ const SessionSidebarComponent: React.FC = ({ openSidebarMenuKey={openSidebarMenuKey} expansionState={recentExpandedParents} variant="section" + isDesktopShellRuntime={isDesktopShellRuntime} /> ) : null, - [activitySections, editingId, hasSessionSearchQuery, isVSCode, openSidebarMenuKey, recentExpandedParents, renderSessionNode, showRecentSection], + [activitySections, editingId, hasSessionSearchQuery, isDesktopShellRuntime, isVSCode, openSidebarMenuKey, recentExpandedParents, renderSessionNode, showRecentSection], ); const isInlineEditing = Boolean(renamingFolderId || editingId || editingProjectDialogId); diff --git a/packages/ui/src/components/session/sidebar/SidebarActivitySections.tsx b/packages/ui/src/components/session/sidebar/SidebarActivitySections.tsx index 6708a11e..8d018ced 100644 --- a/packages/ui/src/components/session/sidebar/SidebarActivitySections.tsx +++ b/packages/ui/src/components/session/sidebar/SidebarActivitySections.tsx @@ -10,6 +10,7 @@ import { resolveMenuOpenSessionId, } from './sessionNodeItemUtils'; import type { SessionNodeRenderExtras } from './sessionNodeItemUtils'; +import { useStickyHeader } from './hooks/useStickyProjectHeaders'; type ActivityItem = { node: SessionNode; @@ -45,6 +46,7 @@ type Props = { variant?: 'section' | 'flat'; initialVisibleCount?: number; batchSize?: number; + isDesktopShellRuntime: boolean; }; type RenderExtras = SessionNodeRenderExtras; @@ -60,12 +62,17 @@ export function SidebarActivitySections(props: Props): React.ReactNode { variant = 'section', initialVisibleCount = MAX_VISIBLE_RECENT_SESSIONS, batchSize = MAX_VISIBLE_RECENT_SESSIONS, + isDesktopShellRuntime, } = props; const { t } = useI18n(); const stickyZoneHeaders = useSessionDisplayStore((state) => state.stickyZoneHeaders); const [collapsed, setCollapsed] = React.useState>(new Set()); const [visibleCountBySection, setVisibleCountBySection] = React.useState>(new Map()); const flatVariant = variant === 'flat'; + const { isStuck: isRecentHeaderStuck, sentinelRef: recentHeaderSentinelRef } = useStickyHeader({ + enabled: stickyZoneHeaders && !flatVariant, + isDesktopShellRuntime, + }); const resetSectionLimit = React.useCallback((key: string) => { setVisibleCountBySection((prev) => { @@ -177,11 +184,17 @@ export function SidebarActivitySections(props: Props): React.ReactNode { return (
- {/* Zone header styled like a project header band; sticky with a - solid sidebar backing so rows never show through. */} + {/* Zone header styled like a project header band; its solid + backing applies only after the header is actually stuck. */} +