Microsoft/vscode
Ver no GitHub[webviews] deserializeWebviewPanel is not called when switching workspace trust to restricted
Open
#195.009 aberto em 6 de out. de 2023
bughelp wantedwebview
Métricas do repositório
- Stars
- (74.848 stars)
- Métricas de merge de PR
- (Mesclagem média 11h 43m) (1.000 fundiu PRs em 30d)
Description
Does this issue occur when all extensions are disabled?: Yes/No
It is a custom extension which uses the Webview Api.
- VS Code Version: 1.83.0
- OS Version: Ubuntu 23.04
Steps to Reproduce:
- Use a webview which implements
deserializeWebviewPanel - Write console.log() statements when extension starts, ends, registers deserializeWebviewPanel and inside deserializeWebviewPanel
- Notice that on VSCode reload
deserializeWebviewPanelis called, on workspace trust change to false the extension is reloaded butdeserializeWebviewPanelis not called. - The webview becomes unusable as it is not tracked anymore by the extension (trust=false restarts extension apparently).
First lines are printed when Reload Window is triggered. Last lines when switching the workspace trust to false:
Possible workarounds:
Use onDidGrantWorkspaceTrust which is fired only when trusting the workspace + window.tabGroup Api (available from 1.67) to find the Panel and reuse it.