Skip to content

fix: show error message if connection closed VSCODE-770#1299

Merged
tculig merged 4 commits intomongodb-js:mainfrom
tculig:VSCODE-770-handle-multiple-connections
Apr 2, 2026
Merged

fix: show error message if connection closed VSCODE-770#1299
tculig merged 4 commits intomongodb-js:mainfrom
tculig:VSCODE-770-handle-multiple-connections

Conversation

@tculig
Copy link
Copy Markdown
Contributor

@tculig tculig commented Mar 30, 2026

Ticket: https://jira.mongodb.org/browse/VSCODE-770

image

Description

Checklist

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@tculig tculig changed the title show error message if connection closed fix: show error message if connection closed VSCODE-770 Mar 30, 2026
@tculig tculig marked this pull request as ready for review March 30, 2026 11:38
@tculig tculig requested a review from a team as a code owner March 30, 2026 11:38
Copilot AI review requested due to automatic review settings March 30, 2026 11:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the data browser webview behavior when the underlying MongoDB connection is no longer active (e.g., disconnected or switched), ensuring a clear error is surfaced instead of attempting operations on a stale connection.

Changes:

  • Track the active connection id per opened data-browsing webview panel and validate it on incoming webview messages.
  • Return appropriate webview error messages (documents / totalCount) or VS Code modal errors (mutations) when the panel’s connection no longer matches the active connection.
  • Add a dedicated test suite covering connection-mismatch behavior (VSCODE-770).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/views/dataBrowsingController.ts Stores per-panel connection id and rejects data-related webview commands when the active connection has changed/closed.
src/test/suite/views/dataBrowsingController.test.ts Adds tests validating the new connection-mismatch handling paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/views/dataBrowsingController.ts
Comment thread src/views/dataBrowsingController.ts Outdated
Comment thread src/test/suite/views/dataBrowsingController.test.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tculig tculig enabled auto-merge (squash) April 2, 2026 08:54
@tculig tculig merged commit f15d2b3 into mongodb-js:main Apr 2, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants