@@ -26,9 +26,8 @@ import { SearchJiraHelper } from '../searchJiraHelper';
26
26
import { executeJqlQuery , JiraIssueNode , loginToJiraMessageNode , TreeViewIssue } from './utils' ;
27
27
28
28
const AssignedWorkItemsViewProviderId = AssignedJiraItemsViewId ;
29
-
30
- const InitialCumulativeJqlFetchEventName = 'ui.jira.jqlFetch.render.lcp' ;
31
29
const RefreshCumulativeJqlFetchEventName = 'ui.jira.jqlFetch.update.lcp' ;
30
+ const InitialCumulativeJqlFetchEventName = 'ui.jira.jqlFetch.render.lcp' ;
32
31
33
32
export class AssignedWorkItemsViewProvider extends Disposable implements TreeDataProvider < TreeItem > {
34
33
private static readonly _treeItemConfigureJiraMessage = loginToJiraMessageNode ;
@@ -63,7 +62,14 @@ export class AssignedWorkItemsViewProvider extends Disposable implements TreeDat
63
62
const jqlEntries = Container . jqlManager . getAllDefaultJQLEntries ( ) ;
64
63
if ( jqlEntries . length ) {
65
64
timer . mark ( InitialCumulativeJqlFetchEventName ) ;
66
- this . _initPromises = new PromiseRacer ( jqlEntries . map ( executeJqlQuery ) ) ;
65
+ const promises = jqlEntries . map ( executeJqlQuery ) ;
66
+ this . _initPromises = new PromiseRacer ( promises ) ;
67
+ Promise . all ( promises ) . then ( ( ) => {
68
+ const jqlInitialDuration = timer . measureAndClear ( InitialCumulativeJqlFetchEventName ) ;
69
+ performanceEvent ( InitialCumulativeJqlFetchEventName , jqlInitialDuration ) . then ( ( event ) => {
70
+ Container . analyticsClient . sendTrackEvent ( event ) ;
71
+ } ) ;
72
+ } ) ;
67
73
}
68
74
69
75
Container . context . subscriptions . push ( configuration . onDidChange ( this . onConfigurationChanged , this ) ) ;
@@ -134,7 +140,6 @@ export class AssignedWorkItemsViewProvider extends Disposable implements TreeDat
134
140
// - append the data to `this._children` and resolve this promise returning it
135
141
// - if there are still JQL promises in PromiseRacer, trigger another DidChangeTreeData immediately
136
142
// which will stay pending until the next JQL promise with data resolves, or until all JQL promises are done
137
-
138
143
while ( ! this . _initPromises . isEmpty ( ) ) {
139
144
const issues = await this . _initPromises . next ( ) ;
140
145
if ( ! issues . length ) {
@@ -151,11 +156,6 @@ export class AssignedWorkItemsViewProvider extends Disposable implements TreeDat
151
156
if ( ! this . _initPromises . isEmpty ( ) ) {
152
157
// need to trigger a DidChangeTreeData after this method ends - 10ms as a small-enough timeout
153
158
setTimeout ( ( ) => this . _onDidChangeTreeData . fire ( ) , 10 ) ;
154
- } else {
155
- const jqlInitialDuration = timer . measureAndClear ( InitialCumulativeJqlFetchEventName ) ;
156
- performanceEvent ( InitialCumulativeJqlFetchEventName , jqlInitialDuration ) . then ( ( event ) => {
157
- Container . analyticsClient . sendTrackEvent ( event ) ;
158
- } ) ;
159
159
}
160
160
161
161
return this . _initChildren ;
@@ -167,7 +167,6 @@ export class AssignedWorkItemsViewProvider extends Disposable implements TreeDat
167
167
if ( ! jqlEntries . length ) {
168
168
return [ AssignedWorkItemsViewProvider . _treeItemConfigureJiraMessage ] ;
169
169
}
170
-
171
170
const allIssues = ( await Promise . all ( jqlEntries . map ( executeJqlQuery ) ) ) . flat ( ) ;
172
171
173
172
if ( this . _skipNotificationForNextFetch ) {
0 commit comments