Fixing recent connections in connection dialog#21646
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes connection dialog hydration/display of recent connections by ensuring saved and recent connections with the same connection ID aren’t deduplicated away, and updates the sidebar list ordering to show recent connections first.
Changes:
- Update
ConnectionStore.readAllConnections(true)deduplication to key by(id, profileSource)so saved+MRU entries with the same ID are preserved. - Swap the UI ordering in the Connection Dialog sidebar to display “Recent connections” above “Saved connections”, with the correct delete/remove actions per section.
- Add a unit test to validate that saved and recent entries sharing the same ID are both returned.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| extensions/mssql/src/models/connectionStore.ts | Adjusts deduplication to preserve both saved and MRU entries with the same connection ID. |
| extensions/mssql/src/reactviews/pages/ConnectionDialog/connectionsListContainer.tsx | Reorders recent/saved connection sections and wires the corresponding remove/delete actions. |
| extensions/mssql/test/unit/connectionStore.test.ts | Adds coverage to ensure readAllConnections(true) keeps both saved and recent entries when IDs collide. |
PR Changes
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #21646 +/- ##
==========================================
+ Coverage 74.54% 74.65% +0.11%
==========================================
Files 391 392 +1
Lines 117193 117355 +162
Branches 6650 6710 +60
==========================================
+ Hits 87358 87617 +259
+ Misses 29835 29738 -97
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
abb9a5c
|
Let's discuss what the intended behavior should be for MRU connections. I've added some comments in #21540 |
There was a problem hiding this comment.
Pull request overview
Fixes the Connection Dialog’s “Recent Connections” behavior by preventing recent entries from being dropped during connection list loading, and updates the sidebar list ordering to show “Recent Connections” before “Saved Connections”.
Changes:
- Update
ConnectionStore.readAllConnections()deduplication to consider both connection id and profile source (saved vs MRU). - Reorder the Connection Dialog sidebar sections so Recent Connections appears above Saved Connections.
- Add a unit test to ensure saved and recent entries with the same id are both preserved.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| extensions/mssql/src/models/connectionStore.ts | Adjusts deduplication key to preserve both saved and recent entries that share an id. |
| extensions/mssql/src/reactviews/pages/ConnectionDialog/connectionsListContainer.tsx | Reorders recent/saved sections and updates list rendering keys + actions accordingly. |
| extensions/mssql/test/unit/connectionStore.test.ts | Adds a regression test for preserving saved+recent entries with the same id. |
Comments suppressed due to low confidence (1)
extensions/mssql/src/models/connectionStore.ts:704
- The dedupe key is now
id + profileSource, but the verbose log message still says "Duplicate connection ID found". This is misleading because duplicates are now defined by the composite key (and the duplicate might only exist within the same source). Update the message to reflect the actual dedupe criteria (e.g. includeprofileSourceor the composite key).
const key = `${conn.id}-${conn.profileSource}`; // Use both ID and source as key to allow same profile in both lists
if (!uniqueConnections.has(key)) {
uniqueConnections.set(key, conn);
} else {
dupeCount++;
this._logger.verbose(
`Duplicate connection ID found: ${conn.id}. Ignoring duplicate connection.`,
);
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 5 changed files in this pull request and generated 2 comments.
Files not reviewed (2)
- extensions/mssql/package-lock.json: Language not supported
- extensions/sql-database-projects/package-lock.json: Language not supported
…d ensuring unique entries based on database differences
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
extensions/mssql/src/models/connectionStore.ts:723
- The verbose log message in the de-dupe loop is now misleading: duplicates are detected via
Utils.isSameProfile/isSameRecentConnectionEntry, not necessarily by connection ID, andconn.idmay be undefined (MRU entries). Update the message to describe what was actually considered a duplicate and include a more reliable identifier (e.g., source + server/db/auth/user/accountId) rather than labeling it as an ID duplicate.
} else {
dupeCount++;
this._logger.verbose(
`Duplicate connection ID found: ${conn.id}. Ignoring duplicate connection.`,
);
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
extensions/mssql/src/models/connectionStore.ts:723
readAllConnectionsno longer deduplicates strictly by ID, but the verbose log message still says "Duplicate connection ID found" and logs${conn.id}(which may be undefined or not the reason for dedupe). Update the log message to reflect the actual dedupe criteria (e.g., duplicate connection within same source by identity), and consider including the relevant identity fields in the log for troubleshooting.
this._logger.verbose(
`Duplicate connection ID found: ${conn.id}. Ignoring duplicate connection.`,
);
… generation and redaction
Co-authored-by: Copilot <[email protected]>
Description
Fixes: #21540
Code Changes Checklist
npm run test)Reviewers: Please read our reviewer guidelines