@@ -184,6 +184,8 @@ async function openTopoViewerEditorCommand(node?: c.ClabLabTreeNode) {
184184 setCurrentTopoViewer ( editor ) ;
185185 editor . lastYamlFilePath = yamlUri . fsPath ;
186186 await editor . createWebviewPanel ( ctx , yamlUri , labName ) ;
187+ // Ensure the global TopoViewer state tracks the created panel so command callbacks can update it
188+ setCurrentTopoViewer ( editor ) ;
187189 if ( editor . currentPanel ) {
188190 editor . currentPanel . onDidDispose ( ( ) => {
189191 setCurrentTopoViewer ( undefined ) ;
@@ -214,6 +216,8 @@ async function createTopoViewerTemplateFileCommand() {
214216 try {
215217 await editor . createTemplateFile ( uri ) ;
216218 await editor . createWebviewPanel ( ctx , uri , labName ) ;
219+ // Update the global viewer reference now that the panel is available
220+ setCurrentTopoViewer ( editor ) ;
217221 if ( editor . currentPanel ) {
218222 editor . currentPanel . onDidDispose ( ( ) => {
219223 setCurrentTopoViewer ( undefined ) ;
@@ -276,7 +280,8 @@ function onDidChangeConfiguration(e: vscode.ConfigurationChangeEvent) {
276280
277281function refreshTask ( ) {
278282 ins . update ( ) . then ( ( ) => {
279- runningLabsProvider . softRefresh ( ) ;
283+ localLabsProvider ?. refresh ( ) ;
284+ runningLabsProvider ?. softRefresh ( ) ;
280285 } ) ;
281286}
282287
0 commit comments