diff --git a/extensions/gitpod-web/src/extension.ts b/extensions/gitpod-web/src/extension.ts index 3248107c78acd..90eb3ab993b42 100644 --- a/extensions/gitpod-web/src/extension.ts +++ b/extensions/gitpod-web/src/extension.ts @@ -354,8 +354,11 @@ export class GitpodWorkspaceTreeDataProvider implements vscode.TreeDataProvider< const localPort = portStatus.getLocalPort(); const tunnel = this.tunnelMap.get(localPort); toClean?.delete(localPort); - const port = this.ports.ports.get(localPort) || new PortTreeItem(new GitpodWorkspacePort(localPort, this.context, portStatus, tunnel)); - const prevStatus = port.port.status; + let port = this.ports.ports.get(localPort); + const prevStatus = port?.port.status; + if (!port) { + port = new PortTreeItem(new GitpodWorkspacePort(localPort, this.context, portStatus, tunnel)); + } this.ports.ports.set(localPort, port); port.port.update(portStatus, tunnel); @@ -435,18 +438,18 @@ export class GitpodPortViewProvider implements vscode.WebviewViewProvider { // content="default-src 'none'; img-src data: ${webview.cspSource}; font-src ${webview.cspSource}; style-src ${webview.cspSource} 'nonce-${nonce}'; script-src 'nonce-${nonce}';" // /> return ` - -
- - - - - -