-
Notifications
You must be signed in to change notification settings - Fork 35
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
Make sure the webview is loaded before sending requests #452
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/main/webview/webviewSidebar.ts
Outdated
webview.onDidChangeVisibility(() => { | ||
private async createEventManager(webview: vscode.WebviewView) { | ||
const eventManager: EventManager = await EventManager.createEventManager(webview.webview, this.connectionManager, this._logManager); | ||
webview.onDidChangeVisibility(async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add it to the context subscriptions to allow cleanup on close:
this.context.subscriptions.push(webview.onDidChangeVisibility...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not sure im getting your point but we have already performed a cleanup at currentWebview.onDidDispose
line 28
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that there is a reason that onDidChangeVisibility returns a disposable. Are you sure that currentWebview.onDidDispose disposes of this listener?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
npm run format
for formatting the code before submitting the pull request.Before this pull request, there was a potential for the Webview to take longer to load than the duration between the IDE sending the first request to the Webview. To address this issue, we now ensure that we wait for a signal indicating the completion of the webview's full loading process before sending any requests.
Dependent on: