@@ -384,6 +384,7 @@ interface SidebarThreadRowProps {
384384 launchedCount : number ;
385385 /** Launched threads and subagents folded away below this one. */
386386 launchedHiddenCount : number ;
387+ launchedFolded : boolean ;
387388 launchDepth : number ;
388389 isFirstLaunchedChild : boolean ;
389390 isLastLaunchedChild : boolean ;
@@ -445,6 +446,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
445446 const {
446447 launchedCount,
447448 launchedHiddenCount,
449+ launchedFolded,
448450 launchDepth,
449451 isFirstLaunchedChild,
450452 isLastLaunchedChild,
@@ -727,7 +729,6 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
727729 void attemptArchiveThread ( threadRef ) ;
728730 } ;
729731 const visibleLaunchDepth = Math . min ( launchDepth , LAUNCHED_THREAD_MAX_VISIBLE_DEPTH ) ;
730- const launchedFolded = launchedHiddenCount > 0 ;
731732 const handleLaunchFoldClick = ( event : React . MouseEvent < HTMLButtonElement > ) => {
732733 event . preventDefault ( ) ;
733734 event . stopPropagation ( ) ;
@@ -853,17 +854,19 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
853854 data-launch-fold
854855 aria-expanded = { ! launchedFolded }
855856 aria-label = {
856- launchedFolded
857+ launchedFolded && launchedHiddenCount > 0
857858 ? `Show ${ launchedHiddenCount } folded ${ launchedHiddenCount === 1 ? "thread" : "threads" } `
858- : `Hide ${ launchedCount } child ${ launchedCount === 1 ? "thread" : "threads" } `
859+ : launchedFolded
860+ ? `Unfold ${ launchedCount } child ${ launchedCount === 1 ? "thread" : "threads" } `
861+ : `Hide ${ launchedCount } child ${ launchedCount === 1 ? "thread" : "threads" } `
859862 }
860863 className = "group/launch-fold relative inline-flex h-4 min-w-4 cursor-pointer items-center justify-center rounded-sm text-muted-foreground/70 outline-hidden hover:text-sidebar-foreground focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring"
861864 onPointerDown = { ( event ) => event . stopPropagation ( ) }
862865 onDoubleClick = { ( event ) => event . stopPropagation ( ) }
863866 onKeyDown = { ( event ) => event . stopPropagation ( ) }
864867 onClick = { handleLaunchFoldClick }
865868 >
866- { launchedFolded ? (
869+ { launchedHiddenCount > 0 ? (
867870 < span className = "text-2xs tabular-nums transition-opacity duration-150 group-hover/menu-sub-item:opacity-0 group-focus-visible/launch-fold:opacity-0" >
868871 { launchedHiddenCount }
869872 </ span >
@@ -1019,7 +1022,10 @@ interface SidebarProjectThreadListProps {
10191022 hiddenThreadStatus : ThreadStatusPill | null ;
10201023 orderedProjectThreadKeys : readonly string [ ] ;
10211024 renderedThreads : readonly SidebarThreadSummary [ ] ;
1022- launchFoldByThreadKey : ReadonlyMap < string , { childCount : number ; hiddenCount : number } > ;
1025+ launchFoldByThreadKey : ReadonlyMap <
1026+ string ,
1027+ { childCount : number ; hiddenCount : number ; folded : boolean }
1028+ > ;
10231029 showEmptyThreadState : boolean ;
10241030 shouldShowThreadPanel : boolean ;
10251031 isThreadListExpanded : boolean ;
@@ -1144,6 +1150,7 @@ const SidebarProjectThreadList = memo(function SidebarProjectThreadList(
11441150 thread = { thread }
11451151 launchedCount = { launchFold ?. childCount ?? 0 }
11461152 launchedHiddenCount = { launchFold ?. hiddenCount ?? 0 }
1153+ launchedFolded = { launchFold ?. folded ?? false }
11471154 launchDepth = { launchTree ?. depth ?? 0 }
11481155 isFirstLaunchedChild = { launchTree ?. isFirstChild ?? true }
11491156 isLastLaunchedChild = { launchTree ?. isLastChild ?? true }
@@ -1343,9 +1350,9 @@ function useFoldedProjectThreads(
13431350 visibleProjectThreads,
13441351 orderedProjectThreadKeys : visibleProjectThreads . map ( keyOf ) ,
13451352 launchFoldByThreadKey : new Map (
1346- foldedProjectThreads . map ( ( { thread, childCount, hiddenCount } ) => [
1353+ foldedProjectThreads . map ( ( { thread, childCount, hiddenCount, folded } ) => [
13471354 keyOf ( thread ) ,
1348- { childCount, hiddenCount } ,
1355+ { childCount, hiddenCount, folded } ,
13491356 ] ) ,
13501357 ) ,
13511358 } ;
0 commit comments