Fixing recent connections in connection dialog#21646
Fixing recent connections in connection dialog#21646aasimkhan30 wants to merge 8 commits intomainfrom
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.05% 74.09% +0.03%
==========================================
Files 339 339
Lines 103055 103081 +26
Branches 6053 6064 +11
==========================================
+ Hits 76321 76375 +54
+ Misses 26734 26706 -28
🚀 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
Description
Fixes: #21540
Code Changes Checklist
npm run test)Reviewers: Please read our reviewer guidelines