Skip to content

fix(tree): hide single-item context menu commands when multiple items selected#693

Merged
tnaum-ms merged 1 commit into
microsoft:mainfrom
hanhan761:fix-668-multiselect-when-clauses
Jun 22, 2026
Merged

fix(tree): hide single-item context menu commands when multiple items selected#693
tnaum-ms merged 1 commit into
microsoft:mainfrom
hanhan761:fix-668-multiselect-when-clauses

Conversation

@hanhan761

@hanhan761 hanhan761 commented May 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Add && !listMultiSelection to the when clause of 36 context menu commands in the Connections tree view. When multiple items are selected, single-item commands are now hidden, preventing silent failures (commands acting on only the first item) or unexpected behavior.

Issue

Fixes #668

Approach

Followed the issue audit table exactly:

  • 36 commands -- Added !listMultiSelection to when clause
  • 2 commands -- Intentionally skipped (already support multi-select: removeConnection, moveItems)
  • Discovery-view-only commands -- Intentionally skipped (discoveryView does not have canSelectMany: true)

Verification

  • npm run build -- TypeScript compilation passes
  • npm run lint -- ESLint passes
  • npm run prettier-fix -- formatting confirmed

@hanhan761 hanhan761 requested a review from a team as a code owner May 29, 2026 13:01
Copilot AI review requested due to automatic review settings May 29, 2026 13:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds an asynchronously loaded index count to the “Indexes” tree node (shown in the description), and updates context menu enablement to avoid showing single-item actions during multi-selection.

Changes:

  • Add background fetching + caching of index counts for a collection’s Indexes node and refresh the tree item when loaded.
  • Kick off index count loading when a Collection is expanded (fire-and-forget).
  • Update many view/item context menu “when” clauses to disable commands when listMultiSelection is active, and add related l10n strings.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 10 comments.

File Description
src/tree/documentdb/IndexesItem.ts Adds async index count loading, caching, and tree refresh + shows count in tree item description.
src/tree/documentdb/CollectionItem.ts Starts the background count load when creating the IndexesItem.
package.json Disables various context menu commands during multi-selection via !listMultiSelection.
l10n/bundle.l10n.json Adds localized strings for singular/plural index count display.

Comment thread src/tree/documentdb/IndexesItem.ts Outdated
Comment thread src/tree/documentdb/IndexesItem.ts
Comment thread src/tree/documentdb/IndexesItem.ts
Comment thread src/tree/documentdb/IndexesItem.ts Outdated
Comment thread src/tree/documentdb/IndexesItem.ts Outdated
Comment thread src/tree/documentdb/CollectionItem.ts
Comment thread src/tree/documentdb/IndexesItem.ts Outdated
Comment thread src/tree/documentdb/IndexesItem.ts Outdated
Comment thread src/tree/documentdb/IndexesItem.ts Outdated
Comment thread src/tree/documentdb/IndexesItem.ts Outdated
@tnaum-ms tnaum-ms force-pushed the fix-668-multiselect-when-clauses branch from ad176d5 to 47414fa Compare June 19, 2026 12:32
@tnaum-ms tnaum-ms removed the in-triage-queue We've seen your input and will triage it label Jun 19, 2026
@tnaum-ms tnaum-ms added this to the 0.9.1 milestone Jun 19, 2026
@tnaum-ms

Copy link
Copy Markdown
Collaborator

Maintainer note (triage)

During triage this branch was rebased onto main and the index-count feature was pruned out, because that functionality already landed separately in PR #714. As a result, the earlier Copilot review comments referencing IndexesItem.ts / CollectionItem.ts / index-count localization strings no longer apply and have been acknowledged inline.

The PR now contains only the intended fix for #668: adding && !listMultiSelection to the single-item context-menu when clauses so those commands hide during multi-selection. No code beyond package.json remains.

Note for reviewers: a quick manual UI check (select multiple tree items, confirm single-item actions disappear) is recommended before merge.

@tnaum-ms tnaum-ms merged commit d37fe55 into microsoft:main Jun 22, 2026
5 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.

Audit context menu commands for tree view multi-select support

4 participants