@@ -518,22 +518,6 @@ export class LaunchpadCommand extends QuickCommand<State> {
518518 } ;
519519 }
520520
521- const combineQuickpickItemsWithSearchResults = < T extends { item : { id : string } } | object > (
522- arr : readonly T [ ] ,
523- items : T [ ] ,
524- ) => {
525- const ids : Set < string > = new Set (
526- arr . map ( i => 'item' in i && i . item ?. id ) . filter ( id => typeof id === 'string' ) ,
527- ) ;
528- const result = [ ...arr ] ;
529- for ( const item of items ) {
530- if ( 'item' in item && item . item ?. id && ! ids . has ( item . item . id ) ) {
531- result . push ( item ) ;
532- }
533- }
534- return result ;
535- } ;
536-
537521 const updateItems = async (
538522 quickpick : QuickPick < LaunchpadItemQuickPickItem | DirectiveQuickPickItem | ConnectMoreIntegrationsItem > ,
539523 ) => {
@@ -552,7 +536,7 @@ export class LaunchpadCommand extends QuickCommand<State> {
552536 }
553537 const { items, placeholder } = getItemsAndPlaceholder ( Boolean ( search ) ) ;
554538 quickpick . placeholder = placeholder ;
555- quickpick . items = search ? combineQuickpickItemsWithSearchResults ( quickpick . items , items ) : items ;
539+ quickpick . items = items ;
556540 } ) ;
557541 } finally {
558542 quickpick . busy = false ;
@@ -630,6 +614,15 @@ export class LaunchpadCommand extends QuickCommand<State> {
630614 }
631615 }
632616
617+ // wait a little bit because the active quickpick is updated with some delay
618+ await new Promise ( resolve => setTimeout ( resolve , 100 ) ) ;
619+ const hasActiveLaunchpadItems = quickpick . activeItems . find ( i => 'item' in i ) ;
620+ if ( hasActiveLaunchpadItems ) {
621+ // We have an active item, so we can exit now without sending any requests to API
622+ this . updateItemsDebouncer . cancel ( ) ;
623+ return true ;
624+ }
625+
633626 await updateItems ( quickpick ) ;
634627 return true ;
635628 } ,
0 commit comments