Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webview Panels Dispose Bug #158839

Closed
andreamah opened this issue Aug 23, 2022 · 2 comments
Closed

Webview Panels Dispose Bug #158839

andreamah opened this issue Aug 23, 2022 · 2 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s)

Comments

@andreamah
Copy link
Contributor

andreamah commented Aug 23, 2022

I was running into an issue where closing a webview panel on extension deactivating. When I add a root to a multi-root workspace, the extension is deactivated (which is expected), but the panel isn't disposed although I specifically ask it to.

Repro steps in extension sample:

  1. Use webview-sample extension sample.
  2. Add code to close panel on deactivate:
export function deactivate() {
	CatCodingPanel.currentPanel?.dispose();
}
  1. open a single-root workspace and start the extension sample (should have the webview appear).
  2. Add another root to the workspace. The messages should stop (since the extension deactivated), but the panel still exists. 🐛

This is causing an issue in live preview where the preview persists when you add a root to a single-root workspace although the extension has deactivated. 😢

I talked to Rob about this bug in live preview and he found that the issue was here:

He mentioned that it was because the webview panels weren't being disposed properly.

cc: @roblourens

@andreamah andreamah added the bug Issue identified by VS Code Team member as probable bug label Aug 23, 2022
@roblourens
Copy link
Member

@mjbvz even if we don't restart the extension host when going from 1 -> 2 workspace folders, there are other cases where the EH will restart, like when it crashes or you just run the "Restart Extension Host" command. Why wouldn't you just close/clean up all the webview panels when that happens?

@mjbvz
Copy link
Collaborator

mjbvz commented Aug 23, 2022

Duplicate of #98603

@roblourens We trying to avoid abruptly closing webviews as they may contain unsaved work. There's not an elegant way to handle this for every webview, although we may be able to implement something for serializable webviews

@mjbvz mjbvz closed this as completed Aug 23, 2022
@mjbvz mjbvz added the *duplicate Issue identified as a duplicate of another issue(s) label Aug 23, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

3 participants