@@ -222,7 +222,7 @@ export default function ScanCenter() {
222222 return ;
223223 }
224224 const history = res . scanHistory || [ ] ;
225- process . stderr . write ( 'SCAN_HISTORY_SAMPLE: ' + JSON . stringify ( history . slice ( 0 , 3 ) , null , 2 ) + '\n' ) ;
225+ process . stderr . write ( 'SCAN_HISTORY_SAMPLE: ' + JSON . stringify ( history . slice ( 0 , 15 ) , null , 2 ) + '\n' ) ;
226226 setScanHistory ( history ) ;
227227 setStep ( STEPS . SELECT_SCAN ) ;
228228 } ;
@@ -334,19 +334,23 @@ export default function ScanCenter() {
334334
335335 if ( step === STEPS . SELECT_SCAN ) {
336336 const items = scanHistory
337- . map ( ( s , i ) => {
338- if ( ! s || typeof s !== 'object' ) return null ;
339- const date = s . date || s . created_at || s . timestamp ;
337+ . filter ( ( s ) => s && typeof s === 'object' && s . latest_commit_sha )
338+ . slice ( )
339+ . sort ( ( a , b ) => {
340+ const da = new Date ( a . timestamp || a . date || a . created_at || 0 ) ;
341+ const db = new Date ( b . timestamp || b . date || b . created_at || 0 ) ;
342+ return db - da ;
343+ } )
344+ . map ( ( s ) => {
345+ const date = s . timestamp || s . date || s . created_at ;
340346 const branch = s . branch || s . ref || '' ;
341- const commitFull = s . commit_id || s . commitId || '' ;
342- const commit = commitFull . slice ( 0 , 8 ) ;
347+ const commitFull = s . latest_commit_sha || '' ;
343348 return {
344- label : ( commit || `scan- ${ i + 1 } ` ) + ( branch ? ' ' + branch : '' ) ,
345- sublabel : [ commitFull , date ? new Date ( date ) . toLocaleString ( ) : null ] . filter ( Boolean ) . join ( ' ' ) ,
349+ label : branch || '(no branch)' ,
350+ sublabel : [ commitFull || null , date ? new Date ( date ) . toLocaleString ( ) : null ] . filter ( Boolean ) . join ( ' ' ) ,
346351 value : { ...s , commitId : commitFull } ,
347352 } ;
348- } )
349- . filter ( Boolean ) ;
353+ } ) ;
350354 return ce (
351355 Box ,
352356 { flexDirection : 'column' } ,
0 commit comments