Skip to content

fix(combobox): show selected values in multi-select trigger label#4721

Merged
waleedlatif1 merged 4 commits into
stagingfrom
waleedlatif1/multi-select-channels-display
May 22, 2026
Merged

fix(combobox): show selected values in multi-select trigger label#4721
waleedlatif1 merged 4 commits into
stagingfrom
waleedlatif1/multi-select-channels-display

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Multi-select Combobox trigger was showing the placeholder ("Select one or more channels") even after the user picked items — the trigger only read selectedOption and ignored multiSelectValues
  • Added derived multiSelectLabel so the collapsed trigger shows the selection: 1 → label, 2 → "A, B", 3+ → "A, B +N"
  • Follow-up to improvement(kb-connectors): multi-select fields + Slack bot/app message extraction #4711 (KB connector multi-select)

Type of Change

  • Bug fix

Testing

Tested manually — the trigger now reflects the selected channels in the dropdown.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

The collapsed trigger was reading only `selectedOption` (the single-value
path) and falling back to the placeholder when nothing matched, so a
multi-select dropdown with 1+ checked items still rendered "Select one or
more channels" instead of the actual selections.

Added `multiSelectLabel` derived from `multiSelectValues`:
- 1 value  → that label
- 2 values → "A, B"
- 3+       → "A, B +N"

Trigger now prefers `multiSelectLabel` when present and falls back to the
single-select label / placeholder otherwise. Muted-text color also flips
off when multi has any selection.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped May 22, 2026 3:42pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 22, 2026

PR Summary

Low Risk
Low risk UI-only behavior change to Combobox trigger text plus small UX tweaks in connector modals; concurrency changes are limited to making existing tests deterministic with fake timers.

Overview
Fixes Combobox multi-select triggers to show the selected values instead of falling back to the placeholder by deriving a condensed multiSelectLabel (e.g., A, B +N) for the collapsed state.

Updates the add/edit connector modals to show config-field descriptions via an Info tooltip next to the label (instead of inline helper text), and makes withLeaderLock follower timeout tests deterministic by switching to fake timers and adjusting poll/wait timings.

Reviewed by Cursor Bugbot for commit 37a34cf. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 22, 2026

Greptile Summary

This PR fixes the multi-select Combobox trigger always showing the placeholder by computing a multiSelectLabel memo that derives a human-readable string from the selected values, and separately moves connector-field descriptions from static paragraph text into hover tooltips on an Info icon.

  • combobox.tsx: Adds multiSelectLabel (1 item → label, 2 → "A, B", 3+ → "A, B +N") and threads it into the trigger display; the muted-text guard is updated to account for the new label.
  • add-connector-modal.tsx / edit-connector-modal.tsx: field.description is now surfaced as a Tooltip on a small Info icon next to the label instead of a paragraph below it, consistent with the existing canonical-pair tooltip pattern in both files.
  • leader-lock.test.ts: Two timing-sensitive follower tests are converted from real-time sleep delays to vi.useFakeTimers + advanceTimersByTimeAsync, making them deterministic on slow CI.

Confidence Score: 5/5

The change is a targeted UI fix with no effect on data persistence, API calls, or business logic — safe to merge.

All four files make narrow, well-scoped changes: the combobox label logic is straightforward and correctly handles the empty, single, double, and overflow cases; the modal tooltip refactor is purely presentational; and the test improvements make previously flaky tests reliable without altering their assertions.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/components/emcn/components/combobox/combobox.tsx Adds multiSelectLabel memo to show selected values in the collapsed trigger; correctly falls back to the raw value string when the matching option hasn't loaded yet.
apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/add-connector-modal/add-connector-modal.tsx Moves field.description from a static paragraph below the label to a tooltip on an Info icon next to the label; pattern is identical to the existing canonical-pair tooltip already in this file.
apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/edit-connector-modal/edit-connector-modal.tsx Same description-to-tooltip refactor as the add-connector modal, keeping both modals consistent.
apps/sim/lib/concurrency/tests/leader-lock.test.ts Two flaky timing tests are converted to use vi.useFakeTimers with advanceTimersByTimeAsync, making them deterministic; the expected call counts and return values are still correct under the new parameters.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Combobox trigger renders] --> B{multiSelect mode?}
    B -- No --> C{selectedOption?}
    C -- Yes --> D[Show selectedOption.label]
    C -- No --> E[Show placeholder\nmuted style]
    B -- Yes --> F{multiSelectValues\nnon-empty?}
    F -- No --> C
    F -- Yes --> G{Count}
    G -- 1 --> H[Show label]
    G -- 2 --> I["Show 'A, B'"]
    G -- 3+ --> J["Show 'A, B +N'"]
Loading

Reviews (2): Last reviewed commit: "improvement(kb-connectors): restore fiel..." | Re-trigger Greptile

Removed 41 inline `description:` lines from configFields across 16 connectors
(Slack, MS Teams, GCal, Gmail, Notion, Linear-adjacent, Discord, Dropbox,
Evernote, Fireflies, Google Sheets, Intercom, Obsidian, Outlook, Reddit,
ServiceNow, WordPress, Zendesk). They mostly restated the field title (e.g.
"Channels to sync messages from" under a "Channels" label) and cluttered
the add/edit modal. Field titles + placeholders already communicate intent.

Connector-level `description` (used in the connector picker grid) is
unchanged.
… polling

The "follower does a final read after timeout" test (and the
"follower returns null after timeout" test) relied on real-clock
`setTimeout` and `Date.now()` with very tight bounds (pollIntervalMs=5,
maxWaitMs=9). Any CI scheduler jitter of >4ms would cause the second
in-loop poll to be skipped, the polls counter to end at 2 instead of 3,
and the assertion `expect(result).toBe('late-leader')` to fail.

Switched both tests to `vi.useFakeTimers()` so the schedule is driven by
mocked time advanced via `vi.advanceTimersByTimeAsync`. The intent is
unchanged — verify that the in-loop deadline triggers exactly one
post-deadline last-chance call to `onFollower` — but the assertions no
longer depend on wall-clock timing.

Verified across 5 sequential runs with zero flakes.
…ooltips

Restores the 41 field-level `description` lines stripped in fc64421, but
instead of rendering them as inline muted-text paragraphs they're shown via a
small Info icon next to each field title. Hovering or focusing the icon
reveals the description in the existing emcn Tooltip. Keeps the modal layout
tight while preserving the per-field guidance.

Used <button type="button"> as the tooltip trigger (Radix asChild) rather
than <span tabIndex={0}> to satisfy a11y/noNoninteractiveTabindex.
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 37a34cf. Configure here.

@waleedlatif1 waleedlatif1 merged commit b6d08fb into staging May 22, 2026
14 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/multi-select-channels-display branch May 22, 2026 15:52
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.

1 participant