Skip to content

Conversation

@msynk
Copy link
Member

@msynk msynk commented Nov 2, 2025

closes #11550

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved synchronization of selected items with dropdown values when using provider-backed data sources to ensure selections remain consistent.
    • Enhanced item sourcing logic for better provider compatibility.
  • Refactor

    • Optimized internal item tracking and selection state management for improved reliability.

@coderabbitai
Copy link

coderabbitai bot commented Nov 2, 2025

Walkthrough

Fixed multiselect dropdown state synchronization by renaming the internal tracking collection from _lastShowItems to _lastShownItems and adjusting item sourcing logic to properly synchronize _selectedItems with Values when using ItemsProvider-backed data.

Changes

Cohort / File(s) Summary
Dropdown ItemsProvider State Synchronization
src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cs
Renamed _lastShowItems to _lastShownItems throughout. Updated item sourcing to prefer ItemsProvider-backed data when available. Extended UpdateSelectedItemsFromValues to remove non-listed items from _selectedItems when Values is present, ensuring selected items reflect current state in both single- and multi-select modes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • State synchronization logic across multiple methods requires careful validation to ensure no edge cases in single/multi-select modes
  • Verify UpdateSelectedItemsFromValues correctly handles ItemsProvider data and doesn't introduce regressions in deselection scenarios
  • Confirm GetSearchedItems and InternalItemsProvider correctly reference the renamed field

Poem

🐰 A dropdown that knew better ways,
To track the items through changing days,
Now when you click to deselect,
The ghost text vanishes—perfect!
State and selection finally align,
With _lastShownItems redesigned.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "Fix deselect issues of multiselect BitDropdown with ItemProvider (#11550)" accurately describes the main objective of the changeset. The code changes focus on fixing synchronization issues between the Values property and the internal _selectedItems collection when using ItemProvider with multiselect mode, which directly addresses the reported bug where deselected items continue to display in the dropdown text. The title is specific, clear, and relates directly to the primary problem being solved.
Linked Issues Check ✅ Passed The code changes align with the requirements from issue #11550. The issue reports that when using ItemProvider with multiselect, selecting and then deselecting options leaves the dropdown text showing a selected option instead of clearing the display. The changes address this by renaming the internal tracking collection, adjusting item sourcing logic to properly use ItemsProvider-backed data, and critically extending UpdateSelectedItemsFromValues to synchronize _selectedItems with Values, ensuring deselected items are properly removed and the UI reflects the correct state. These modifications directly resolve the reported synchronization problem.
Out of Scope Changes Check ✅ Passed All changes in the pull request are directly scoped to fixing the deselect issue in multiselect BitDropdown with ItemProvider. The internal field rename from _lastShowItems to _lastShownItems, updates to item sourcing logic, synchronization of _selectedItems with Values, and control flow adjustments all contribute to resolving the synchronization problem between the ItemProvider-backed data and selected items display. No extraneous modifications or unrelated refactoring outside the scope of issue #11550 are present in the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 7cb4e86 and 83cfa93.

📒 Files selected for processing (1)
  • src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cs (7 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build and test
🔇 Additional comments (1)
src/BlazorUI/Bit.BlazorUI/Components/Inputs/Dropdown/BitDropdown.razor.cs (1)

978-981: Stale selection cleanup looks solid. Trimming _selectedItems when their values are no longer present keeps the ItemProvider-backed multiselect text from hanging onto deselected entries, which directly addresses the reported regression.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@msynk msynk merged commit 1efb1f3 into bitfoundation:develop Nov 2, 2025
3 checks passed
@msynk msynk deleted the 11550-blazorui-dropdown-multiselect-itemprovider-deselect-issue branch November 2, 2025 12:27
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.

Problem with multiselect dropdown

1 participant