@@ -161,22 +161,8 @@ export class StartWorkCommand extends QuickCommand<State> {
161161 }
162162 }
163163
164- await updateContextItems ( this . container , context ) ;
165- if ( this . container . telemetry . enabled ) {
166- this . container . telemetry . sendEvent (
167- opened ? 'startWork/steps/issue' : 'startWork/opened' ,
168- {
169- ...context . telemetryContext ! ,
170- connected : true ,
171- type : state . type ,
172- } ,
173- this . source ,
174- ) ;
175- }
176-
164+ const result = yield * this . pickIssueStep ( state , context , opened ) ;
177165 opened = true ;
178-
179- const result = yield * this . pickIssueStep ( state , context ) ;
180166 if ( result === StepResultBreak ) continue ;
181167 if ( ! isStartWorkTypeItem ( result ) ) {
182168 state . item = result ;
@@ -420,6 +406,7 @@ export class StartWorkCommand extends QuickCommand<State> {
420406 private * pickIssueStep (
421407 state : StepState < State > ,
422408 context : Context ,
409+ opened : boolean ,
423410 ) : StepResultGenerator < StartWorkItem | StartWorkTypeItem > {
424411 const buildIssueItem = ( i : StartWorkItem ) => {
425412 const buttons = i . item . issue . url ? [ OpenOnGitHubQuickInputButton ] : [ ] ;
@@ -470,14 +457,37 @@ export class StartWorkCommand extends QuickCommand<State> {
470457 } ;
471458 }
472459
473- const { items, placeholder } = getItemsAndPlaceholder ( ) ;
460+ const updateItems = async ( quickpick : QuickPick < any > ) => {
461+ quickpick . busy = true ;
462+ try {
463+ await updateContextItems ( this . container , context ) ;
464+ const { items, placeholder } = getItemsAndPlaceholder ( ) ;
465+ quickpick . placeholder = placeholder ;
466+ quickpick . items = items ;
467+
468+ if ( this . container . telemetry . enabled ) {
469+ this . container . telemetry . sendEvent (
470+ opened ? 'startWork/steps/issue' : 'startWork/opened' ,
471+ {
472+ ...context . telemetryContext ! ,
473+ connected : true ,
474+ type : state . type ,
475+ } ,
476+ this . source ,
477+ ) ;
478+ }
479+ } finally {
480+ quickpick . busy = false ;
481+ }
482+ } ;
474483
475- const step = createPickStep < ( typeof items ) [ 0 ] > ( {
484+ const step = createPickStep < QuickPickItemOfT < StartWorkItem | StartWorkTypeItem > > ( {
476485 title : context . title ,
477- placeholder : placeholder ,
486+ placeholder : 'Loading...' ,
478487 matchOnDescription : true ,
479488 matchOnDetail : true ,
480- items : items ,
489+ items : [ ] ,
490+ onDidActivate : updateItems ,
481491 onDidClickItemButton : ( _quickpick , button , { item } ) => {
482492 if ( button === OpenOnGitHubQuickInputButton && ! isStartWorkTypeItem ( item ) ) {
483493 this . open ( item ) ;
0 commit comments