Skip to content

Commit

Permalink
Fix sandbox stuck loading (#3325)
Browse files Browse the repository at this point in the history
Don't `await` message being sent to the webview when the webview is
being built,
since the webview is likely unable to receive the message yet.

Fixes #3323

Signed-off-by: David Thompson <[email protected]>
  • Loading branch information
datho7561 authored Sep 26, 2023
1 parent 06a8bfa commit f201109
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/webview/cluster/clusterViewLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ export default class ClusterViewLoader {
await cfg.update('crcNameserver', event.nameserver);
}

// eslint-disable-next-line @typescript-eslint/require-await
static async loadView(title: string): Promise<vscode.WebviewPanel> {
const localResourceRoot = vscode.Uri.file(path.join(ClusterViewLoader.extensionPath, 'out', 'clusterViewer'));
if (panel) {
Expand All @@ -372,11 +371,13 @@ export default class ClusterViewLoader {
});
panel.iconPath = vscode.Uri.file(path.join(ClusterViewLoader.extensionPath, 'images/context/cluster-node.png'));
panel.webview.html = await loadWebviewHtml('clusterViewer', panel);
await panel.webview.postMessage({action: 'cluster', data: ''});
const messageListenerDisposable = panel.webview.onDidReceiveMessage(clusterEditorMessageListener);
panel.onDidDispose(()=> {
messageListenerDisposable.dispose();
panel = undefined;
});
panel.webview.onDidReceiveMessage(clusterEditorMessageListener);
// don't await this message being sent, since the webview may not be set up yet
void panel.webview.postMessage({action: 'cluster', data: ''});
}
return panel;
}
Expand Down

0 comments on commit f201109

Please sign in to comment.