@@ -19,7 +19,7 @@ import Logger from '../common/logger';
1919import { PR_SETTINGS_NAMESPACE , PULL_BRANCH , PULL_PR_BRANCH_BEFORE_CHECKOUT , PullPRBranchVariants } from '../common/settingKeys' ;
2020import { ITelemetry } from '../common/telemetry' ;
2121import { fromReviewUri , ReviewUriParams , Schemes , toReviewUri } from '../common/uri' ;
22- import { formatError , groupBy , uniqBy } from '../common/utils' ;
22+ import { arrayFindIndexAsync , formatError , groupBy , uniqBy } from '../common/utils' ;
2323import { FolderRepositoryManager } from '../github/folderRepositoryManager' ;
2424import { GHPRComment , GHPRCommentThread , TemporaryComment } from '../github/prComment' ;
2525import { PullRequestOverviewPanel } from '../github/pullRequestOverview' ;
@@ -275,12 +275,12 @@ export class ReviewCommentController extends CommentControllerBase implements Co
275275 ) ;
276276
277277 this . _register (
278- activePullRequest . onDidChangeReviewThreads ( e => {
278+ activePullRequest . onDidChangeReviewThreads ( async e => {
279279 const githubRepositories = this . githubReposForPullRequest ( this . _folderRepoManager . activePullRequest ) ;
280- e . added . forEach ( async thread => {
280+ for ( const thread of e . added ) {
281281 const { path } = thread ;
282282
283- const index = this . _pendingCommentThreadAdds . findIndex ( async t => {
283+ const index = await arrayFindIndexAsync ( this . _pendingCommentThreadAdds , async t => {
284284 const fileName = this . _folderRepoManager . gitRelativeRootPath ( t . uri . path ) ;
285285 if ( fileName !== thread . path ) {
286286 return false ;
@@ -324,24 +324,24 @@ export class ReviewCommentController extends CommentControllerBase implements Co
324324 } else {
325325 threadMap [ path ] = [ newThread ] ;
326326 }
327- } ) ;
327+ }
328328
329- e . changed . forEach ( thread => {
329+ for ( const thread of e . changed ) {
330330 const match = this . _findMatchingThread ( thread ) ;
331331 if ( match . index > - 1 ) {
332332 const matchingThread = match . threadMap [ thread . path ] [ match . index ] ;
333333 updateThread ( this . _context , matchingThread , thread , githubRepositories ) ;
334334 }
335- } ) ;
335+ }
336336
337- e . removed . forEach ( thread => {
337+ for ( const thread of e . removed ) {
338338 const match = this . _findMatchingThread ( thread ) ;
339339 if ( match . index > - 1 ) {
340340 const matchingThread = match . threadMap [ thread . path ] [ match . index ] ;
341341 match . threadMap [ thread . path ] . splice ( match . index , 1 ) ;
342342 matchingThread . dispose ( ) ;
343343 }
344- } ) ;
344+ }
345345
346346 this . updateResourcesWithCommentingRanges ( ) ;
347347 } ) ,
0 commit comments