@@ -363,6 +363,7 @@ async function registerPorts(context: GitpodExtensionContext): Promise<void> {
363
363
context . subscriptions . push ( experiments ) ;
364
364
365
365
const portMap = new Map < number , GitpodWorkspacePort > ( ) ;
366
+ let portList : GitpodWorkspacePort [ ] = [ ] ;
366
367
const tunnelMap = new Map < number , vscode . TunnelDescription > ( ) ;
367
368
368
369
// register tree view
@@ -394,11 +395,14 @@ async function registerPorts(context: GitpodExtensionContext): Promise<void> {
394
395
evts . on ( 'error' , reject ) ;
395
396
evts . on ( 'data' , ( update : PortsStatusResponse ) => {
396
397
portMap . clear ( ) ;
397
- const portList = update . getPortsList ( ) . map ( p => p . toObject ( ) ) ;
398
- for ( const portStatus of portList ) {
399
- portMap . set ( portStatus . localPort , new GitpodWorkspacePort ( portStatus . localPort , portStatus , tunnelMap . get ( portStatus . localPort ) ) ) ;
398
+ portList = [ ] ;
399
+ const tmpPortList = update . getPortsList ( ) . map ( p => p . toObject ( ) ) ;
400
+ for ( const portStatus of tmpPortList ) {
401
+ const port = new GitpodWorkspacePort ( portStatus . localPort , portStatus , tunnelMap . get ( portStatus . localPort ) ) ;
402
+ portList . push ( port ) ;
403
+ portMap . set ( portStatus . localPort , port ) ;
400
404
}
401
- portViewProvider . updatePortsStatus ( portList ) ;
405
+ portViewProvider . updatePortsStatus ( tmpPortList ) ;
402
406
gitpodWorkspaceTreeDataProvider . updatePortsStatus ( update ) ;
403
407
} ) ;
404
408
} ) ;
@@ -504,7 +508,8 @@ async function registerPorts(context: GitpodExtensionContext): Promise<void> {
504
508
async function updateStatusBar ( ) : Promise < void > {
505
509
const exposedPorts : number [ ] = [ ] ;
506
510
507
- for ( const port of portMap . values ( ) ) {
511
+
512
+ for ( const port of portList ) {
508
513
if ( isExposedServedGitpodWorkspacePort ( port ) ) {
509
514
exposedPorts . push ( port . status . localPort ) ;
510
515
}
0 commit comments