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

Update connection.ts #3

Merged
merged 1 commit into from
Apr 18, 2024
Merged

Update connection.ts #3

merged 1 commit into from
Apr 18, 2024

Conversation

hanlaman
Copy link
Owner

@hanlaman hanlaman commented Apr 18, 2024

References

Incorrect disposal of LSP connection due to access to undefined serverRequests jupyterlab#16185

Code changes

dispose(): void {
if (this.isDisposed) {
return;
}

// Check if serverRequests is defined before accessing its values
if (this.serverRequests) {
Object.values(this.serverRequests).forEach(request =>
request.clearHandler()
);
}

// Other disposal logic here
}

Modified the dispose() method in connection.ts to include a check for this.serverRequests before accessing its values during disposal.

Added a conditional check to ensure that connections are disposed only if serverRequests is defined, preventing the TypeError on kernel switching.

Modified the 'dispose()' method in 'connection.ts' to include a check for 'this.serverRequests' before accessing its values during disposal.

Added a conditional check to ensure that connections are disposed only if 'serverRequests' is defined.
@hanlaman hanlaman merged commit 3c30575 into main Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant