Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helm chart web view stuck when opening the second time #3623

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/webview/helm-chart/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@
<body>
<div class="box" id="root"></div>
<script src="%SCRIPT%" ></script>
<link rel="stylesheet" href="%STYLE%"></link>
</body>
</html>
43 changes: 21 additions & 22 deletions src/webview/helm-chart/helmChartLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,12 @@
}

export default class HelmChartLoader {
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type

static get extensionPath() {
return vscode.extensions.getExtension(ExtensionID).extensionPath
}

// eslint-disable-next-line @typescript-eslint/require-await
static async loadView(title: string, url?: string): Promise<vscode.WebviewPanel> {
static async loadView(title: string): Promise<vscode.WebviewPanel> {

Check warning on line 142 in src/webview/helm-chart/helmChartLoader.ts

View check run for this annotation

Codecov / codecov/patch

src/webview/helm-chart/helmChartLoader.ts#L142

Added line #L142 was not covered by tests
const localResourceRoot = vscode.Uri.file(path.join(HelmChartLoader.extensionPath, 'out', 'helmChartViewer'));
if (panel) {
// If we already have a panel, show it in the target column
Expand All @@ -154,10 +153,11 @@
});
panel.iconPath = vscode.Uri.file(path.join(HelmChartLoader.extensionPath, 'images/helm/helm.svg'));
panel.webview.html = await loadWebviewHtml('helmChartViewer', panel);
const messageDisposable = panel.webview.onDidReceiveMessage(helmChartMessageListener);

Check warning on line 156 in src/webview/helm-chart/helmChartLoader.ts

View check run for this annotation

Codecov / codecov/patch

src/webview/helm-chart/helmChartLoader.ts#L156

Added line #L156 was not covered by tests
panel.onDidDispose(() => {
messageDisposable.dispose();

Check warning on line 158 in src/webview/helm-chart/helmChartLoader.ts

View check run for this annotation

Codecov / codecov/patch

src/webview/helm-chart/helmChartLoader.ts#L158

Added line #L158 was not covered by tests
panel = undefined;
});
panel.webview.onDidReceiveMessage(helmChartMessageListener);
}
await getHelmCharts();
return panel;
Expand All @@ -170,25 +170,24 @@
}

async function getHelmCharts(): Promise<void> {
if (helmCharts.length === 0) {
const cliData = await Helm.getHelmRepos();
if (!cliData.error && !cliData.stderr) {
const helmRepos = JSON.parse(cliData.stdout) as HelmRepo[];
void panel?.webview.postMessage(
{
action: 'getHelmRepos',
data: {
helmRepos
}
helmCharts.length = 0;
const cliData = await Helm.getHelmRepos();
if (!cliData.error && !cliData.stderr) {
const helmRepos = JSON.parse(cliData.stdout) as HelmRepo[];
void panel?.webview.postMessage(

Check warning on line 177 in src/webview/helm-chart/helmChartLoader.ts

View check run for this annotation

Codecov / codecov/patch

src/webview/helm-chart/helmChartLoader.ts#L173-L177

Added lines #L173 - L177 were not covered by tests
{
action: 'getHelmRepos',
data: {
helmRepos
}
);
helmRepos.forEach((helmRepo: HelmRepo) => {
let url = helmRepo.url;
url = url.endsWith('/') ? url : url.concat('/');
url = url.concat('index.yaml');
void fetchURL(helmRepo, url);
});
}
}
);
helmRepos.forEach((helmRepo: HelmRepo) => {
let url = helmRepo.url;
url = url.endsWith('/') ? url : url.concat('/');
url = url.concat('index.yaml');
void fetchURL(helmRepo, url);

Check warning on line 189 in src/webview/helm-chart/helmChartLoader.ts

View check run for this annotation

Codecov / codecov/patch

src/webview/helm-chart/helmChartLoader.ts#L185-L189

Added lines #L185 - L189 were not covered by tests
});
}
}

Expand Down
Loading