@@ -166,22 +166,8 @@ export class StartWorkCommand extends QuickCommand<State> {
166
166
}
167
167
}
168
168
169
- await updateContextItems ( this . container , context ) ;
170
- if ( this . container . telemetry . enabled ) {
171
- this . container . telemetry . sendEvent (
172
- opened ? 'startWork/steps/issue' : 'startWork/opened' ,
173
- {
174
- ...context . telemetryContext ! ,
175
- connected : true ,
176
- type : state . type ,
177
- } ,
178
- this . source ,
179
- ) ;
180
- }
181
-
169
+ const result = yield * this . pickIssueStep ( state , context , opened ) ;
182
170
opened = true ;
183
-
184
- const result = yield * this . pickIssueStep ( state , context ) ;
185
171
if ( result === StepResultBreak ) continue ;
186
172
if ( ! isStartWorkTypeItem ( result ) ) {
187
173
state . item = result ;
@@ -425,6 +411,7 @@ export class StartWorkCommand extends QuickCommand<State> {
425
411
private * pickIssueStep (
426
412
state : StepState < State > ,
427
413
context : Context ,
414
+ opened : boolean ,
428
415
) : StepResultGenerator < StartWorkItem | StartWorkTypeItem > {
429
416
const buildIssueItem = ( i : StartWorkItem ) => {
430
417
const buttons = i . item . issue . url ? [ OpenOnGitHubQuickInputButton ] : [ ] ;
@@ -475,14 +462,37 @@ export class StartWorkCommand extends QuickCommand<State> {
475
462
} ;
476
463
}
477
464
478
- const { items, placeholder } = getItemsAndPlaceholder ( ) ;
465
+ const updateItems = async ( quickpick : QuickPick < any > ) => {
466
+ quickpick . busy = true ;
467
+ try {
468
+ await updateContextItems ( this . container , context ) ;
469
+ const { items, placeholder } = getItemsAndPlaceholder ( ) ;
470
+ quickpick . placeholder = placeholder ;
471
+ quickpick . items = items ;
472
+
473
+ if ( this . container . telemetry . enabled ) {
474
+ this . container . telemetry . sendEvent (
475
+ opened ? 'startWork/steps/issue' : 'startWork/opened' ,
476
+ {
477
+ ...context . telemetryContext ! ,
478
+ connected : true ,
479
+ type : state . type ,
480
+ } ,
481
+ this . source ,
482
+ ) ;
483
+ }
484
+ } finally {
485
+ quickpick . busy = false ;
486
+ }
487
+ } ;
479
488
480
- const step = createPickStep < ( typeof items ) [ 0 ] > ( {
489
+ const step = createPickStep < QuickPickItemOfT < StartWorkItem | StartWorkTypeItem > > ( {
481
490
title : context . title ,
482
- placeholder : placeholder ,
491
+ placeholder : 'Loading...' ,
483
492
matchOnDescription : true ,
484
493
matchOnDetail : true ,
485
- items : items ,
494
+ items : [ ] ,
495
+ onDidActivate : updateItems ,
486
496
onDidClickItemButton : ( _quickpick , button , { item } ) => {
487
497
if ( button === OpenOnGitHubQuickInputButton && ! isStartWorkTypeItem ( item ) ) {
488
498
this . open ( item ) ;
0 commit comments