@@ -154,6 +154,8 @@ export class WebviewController<
154154 private /*readonly*/ provider ! : WebviewProvider < State , SerializedState , ShowingArgs > ;
155155 private readonly webview : Webview ;
156156
157+ private viewColumn : ViewColumn | undefined ;
158+
157159 private constructor (
158160 private readonly container : Container ,
159161 private readonly _commandRegistrar : WebviewCommandRegistrar ,
@@ -184,9 +186,15 @@ export class WebviewController<
184186 window . onDidChangeWindowState ( this . onWindowStateChanged , this ) ,
185187 parent . webview . onDidReceiveMessage ( this . onMessageReceivedCore , this ) ,
186188 isInEditor
187- ? parent . onDidChangeViewState ( ( { webviewPanel : { visible, active } } ) =>
188- this . onParentVisibilityChanged ( visible , active ) ,
189- )
189+ ? parent . onDidChangeViewState ( ( { webviewPanel } ) => {
190+ const { visible, active, viewColumn } = webviewPanel ;
191+ this . onParentVisibilityChanged (
192+ visible ,
193+ active ,
194+ typeof this . viewColumn !== 'undefined' && this . viewColumn !== viewColumn ,
195+ ) ;
196+ this . viewColumn = viewColumn ;
197+ } )
190198 : parent . onDidChangeVisibility ( ( ) => this . onParentVisibilityChanged ( this . visible , this . active ) ) ,
191199 parent . onDidDispose ( this . onParentDisposed , this ) ,
192200 ...( this . provider . registerCommands ?.( ) ?? [ ] ) ,
@@ -466,7 +474,10 @@ export class WebviewController<
466474 }
467475
468476 @debug ( )
469- private onParentVisibilityChanged ( visible : boolean , active ?: boolean ) {
477+ private onParentVisibilityChanged ( visible : boolean , active ?: boolean , forceReload ?: boolean ) {
478+ if ( forceReload ) {
479+ void this . refresh ( ) ;
480+ }
470481 if ( this . descriptor . webviewHostOptions ?. retainContextWhenHidden !== true ) {
471482 if ( visible ) {
472483 if ( this . _ready ) {
0 commit comments