Skip to content

Tab list gets corrupted when a new webview is opened (extension API) #228270

@mmueller2012

Description

@mmueller2012

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: Works <= 1.89.1, broken >= 1.90.2
  • OS Version: Linux x64 6.1.0-23-amd64

We develop an extension in which an existing tab gets replaced by a webview. We simply store a reference to the existing tab, open a webview and then close the original tab. This has worked fine up to version 1.89.1. On version >= 1.90.2 closing the tab using vscode.window.tabGroups.close fails with the exception Tab close: Invalid tab not found!. The tab has not been closed in the meantime nor did we get any close notifications for it via vscode.window.tabGroups.onDidChangeTabs.

Steps to Reproduce:

  1. Create an extension with the following function exposed as command:
async dummy(): Promise<void> {
	const tab = vscode.window.tabGroups.activeTabGroup.activeTab;
	if (!tab) {
		console.log("Please open a tab to test this code.");
		return;
	}

	const panel = vscode.window.createWebviewPanel(
		"TestPanel",
		"Test",
		tab.group.viewColumn);
	panel.webview.html = "<body>Hello World</body>";

	// Introduce a tiny delay
	await panel.webview.postMessage("hello");

	vscode.window.tabGroups.close(tab);
}
  1. Open some tab and call the command
  2. Check the debug console for the Tab close: Invalid tab not found! exception.

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bugconfirmedIssue has been confirmed by VS Code Team memberregressionSomething that used to work is now brokenworkbench-tabsVS Code editor tab issues

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions