@@ -134,13 +134,12 @@ function helmChartMessageListener(event: any): void {
134134}
135135
136136export default class HelmChartLoader {
137- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
137+
138138 static get extensionPath ( ) {
139139 return vscode . extensions . getExtension ( ExtensionID ) . extensionPath
140140 }
141141
142- // eslint-disable-next-line @typescript-eslint/require-await
143- static async loadView ( title : string , url ?: string ) : Promise < vscode . WebviewPanel > {
142+ static async loadView ( title : string ) : Promise < vscode . WebviewPanel > {
144143 const localResourceRoot = vscode . Uri . file ( path . join ( HelmChartLoader . extensionPath , 'out' , 'helmChartViewer' ) ) ;
145144 if ( panel ) {
146145 // If we already have a panel, show it in the target column
@@ -154,10 +153,11 @@ export default class HelmChartLoader {
154153 } ) ;
155154 panel . iconPath = vscode . Uri . file ( path . join ( HelmChartLoader . extensionPath , 'images/helm/helm.svg' ) ) ;
156155 panel . webview . html = await loadWebviewHtml ( 'helmChartViewer' , panel ) ;
156+ const messageDisposable = panel . webview . onDidReceiveMessage ( helmChartMessageListener ) ;
157157 panel . onDidDispose ( ( ) => {
158+ messageDisposable . dispose ( ) ;
158159 panel = undefined ;
159160 } ) ;
160- panel . webview . onDidReceiveMessage ( helmChartMessageListener ) ;
161161 }
162162 await getHelmCharts ( ) ;
163163 return panel ;
@@ -170,25 +170,24 @@ export default class HelmChartLoader {
170170}
171171
172172async function getHelmCharts ( ) : Promise < void > {
173- if ( helmCharts . length === 0 ) {
174- const cliData = await Helm . getHelmRepos ( ) ;
175- if ( ! cliData . error && ! cliData . stderr ) {
176- const helmRepos = JSON . parse ( cliData . stdout ) as HelmRepo [ ] ;
177- void panel ?. webview . postMessage (
178- {
179- action : 'getHelmRepos' ,
180- data : {
181- helmRepos
182- }
173+ helmCharts . length = 0 ;
174+ const cliData = await Helm . getHelmRepos ( ) ;
175+ if ( ! cliData . error && ! cliData . stderr ) {
176+ const helmRepos = JSON . parse ( cliData . stdout ) as HelmRepo [ ] ;
177+ void panel ?. webview . postMessage (
178+ {
179+ action : 'getHelmRepos' ,
180+ data : {
181+ helmRepos
183182 }
184- ) ;
185- helmRepos . forEach ( ( helmRepo : HelmRepo ) => {
186- let url = helmRepo . url ;
187- url = url . endsWith ( '/' ) ? url : url . concat ( '/' ) ;
188- url = url . concat ( 'index.yaml ' ) ;
189- void fetchURL ( helmRepo , url ) ;
190- } ) ;
191- }
183+ }
184+ ) ;
185+ helmRepos . forEach ( ( helmRepo : HelmRepo ) => {
186+ let url = helmRepo . url ;
187+ url = url . endsWith ( '/' ) ? url : url . concat ( '/ ' ) ;
188+ url = url . concat ( 'index.yaml' ) ;
189+ void fetchURL ( helmRepo , url ) ;
190+ } ) ;
192191 }
193192}
194193
0 commit comments