@@ -78,16 +78,24 @@ export function SubProgressDisplay(
7878) {
7979 const { subProgresses } = props ;
8080
81- return < > {
82- subProgresses && subProgresses
83- // Sort the subprocesses so that in progress ones are always at the bottom
84- . sort ( ( a , b ) => a . status === ProgressStatus . IN_PROGRESS ? 1 : - 1 )
85- // Limit the max number of subprocesses to 5. Too many doesn't look good and causes a wasm memory access error (yoga)
86- . slice ( Math . max ( 0 , subProgresses . length - 5 ) , subProgresses . length )
87- . map ( ( s , idx ) =>
88- s . status === ProgressStatus . IN_PROGRESS
89- ? < Spinner key = { idx } label = { s . label } type = "dots" />
90- : < Text key = { idx } > < Text color = 'greenBright' > ✔</ Text > { s . label } </ Text >
91- )
92- } </ >
81+ if ( ! subProgresses ) return < > </ > ;
82+
83+ const MAX_VISIBLE = 5 ;
84+ const hiddenCount = Math . max ( 0 , subProgresses . length - MAX_VISIBLE ) ;
85+
86+ // Take the last (MAX_VISIBLE - 1) chronologically, leaving room for the "and N others" row
87+ const visibleSlice = subProgresses . slice ( Math . max ( 0 , subProgresses . length - ( MAX_VISIBLE - 1 ) ) ) ;
88+ // Sort within the visible slice so in-progress items appear at the bottom
89+ const sorted = [ ...visibleSlice ] . sort ( ( a , b ) => a . status === ProgressStatus . IN_PROGRESS ? 1 : - 1 ) ;
90+
91+ return < >
92+ { hiddenCount > 0 && (
93+ < Text dimColor > and { hiddenCount } other{ hiddenCount !== 1 ? 's' : '' } ...</ Text >
94+ ) }
95+ { sorted . map ( ( s , idx ) =>
96+ s . status === ProgressStatus . IN_PROGRESS
97+ ? < Spinner key = { idx } label = { s . label } type = "dots" />
98+ : < Text key = { idx } > < Text color = 'greenBright' > ✔</ Text > { s . label } </ Text >
99+ ) }
100+ </ >
93101}
0 commit comments