Microsoft/vscode

Disposing a webview view when extension host is restarted

Open

#188,257 opened on Jul 19, 2023

View on GitHub
 (2 comments) (9 reactions) (1 assignee)TypeScript (10,221 forks)batch import
bughelp wantedwebview-views

Repository metrics

Stars
 (74,848 stars)
PR merge metrics
 (Avg merge 11h 43m) (1,000 merged PRs in 30d)

Description

Originally in https://github.com/microsoft/vscode-pull-request-github/issues/4872#issuecomment-1573555380

Here is what I see happen:

  1. Open a folder
  2. Have an extension that creates a webview view
  3. Keep the webview view open
  4. Add a folder to the workspace, which causes the extension host to be restarted.
  5. The extension's deactivate gets called as expected. In deactivate the extension disposes of the webview view provider.
  6. With this dispose I would expect the webview view to hide, but it does not.

You can easily reproduce the above using the GitHub Pull Request extension with the steps linked from the original issue.

Contributor guide