Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Jan 25, 2026

Link issues

fixes #7325

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Bug Fixes:

  • Ensure Select and MultiSelect components correctly handle placeholder and item loading by relying on the requested item count from the virtualized data provider instead of custom total-based calculations.

Copilot AI review requested due to automatic review settings January 25, 2026 06:26
@bb-auto bb-auto bot added the bug Something isn't working label Jan 25, 2026
@bb-auto bb-auto bot added this to the v10.2.0 milestone Jan 25, 2026
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 25, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the Select and MultiSelect components’ virtualized loading behavior to always request the provider’s requested count, simplifying pagination logic and resolving the issue where the placeholder did not disappear when items were loaded.

Sequence diagram for updated Select LoadItems virtualization flow

sequenceDiagram
    actor User
    participant SelectComponent
    participant Virtualize
    participant DataProvider

    User->>SelectComponent: Open dropdown or type search
    SelectComponent->>Virtualize: Initialize virtualized list
    Virtualize->>SelectComponent: LoadItems(request)
    SelectComponent->>DataProvider: OnQueryAsync(StartIndex, request.Count, SearchText)
    DataProvider-->>SelectComponent: QueryData(TotalCount, Items)
    SelectComponent->>SelectComponent: Update _totalCount, _itemsCache, _result
    SelectComponent-->>Virtualize: ItemsProviderResult
    Virtualize-->>User: Render items and hide placeholder
Loading

Updated class diagram for Select and MultiSelect LoadItems behavior

classDiagram
    class ItemsProviderRequest {
        int StartIndex
        int Count
    }

    class ItemsProviderResult_SelectedItem_ {
        List_SelectedItem_ Items
        int TotalItemCount
    }

    class QueryPageOptions {
        int StartIndex
        int Count
        string SearchText
    }

    class QueryData_SelectedItem_ {
        List_SelectedItem_ Items
        int TotalCount
    }

    class Select {
        string SearchText
        int _totalCount
        List_SelectedItem_ _itemsCache
        ItemsProviderResult_SelectedItem_ _result
        ValueTask~ItemsProviderResult_SelectedItem_~ LoadItems(ItemsProviderRequest request)
        Task~QueryData_SelectedItem_~ OnQueryAsync(QueryPageOptions options)
    }

    class MultiSelect {
        string SearchText
        int _totalCount
        List_SelectedItem_ _itemsCache
        ItemsProviderResult_SelectedItem_ _result
        ValueTask~ItemsProviderResult_SelectedItem_~ LoadItems(ItemsProviderRequest request)
        Task~QueryData_SelectedItem_~ OnQueryAsync(QueryPageOptions options)
    }

    Select ..> ItemsProviderRequest : uses
    Select ..> ItemsProviderResult_SelectedItem_ : returns
    Select ..> QueryPageOptions : builds
    Select ..> QueryData_SelectedItem_ : receives

    MultiSelect ..> ItemsProviderRequest : uses
    MultiSelect ..> ItemsProviderResult_SelectedItem_ : returns
    MultiSelect ..> QueryPageOptions : builds
    MultiSelect ..> QueryData_SelectedItem_ : receives
Loading

File-Level Changes

Change Details Files
Simplified virtualized data loading in Select and MultiSelect to always respect the ItemsProviderRequest.Count and removed custom count calculation logic.
  • Changed LoadItems to call OnQueryAsync with Count set directly from the incoming ItemsProviderRequest.Count, regardless of search text presence.
  • Removed conditional logic that computed a custom count based on SearchText and cached _totalCount.
  • Deleted the local GetCountByTotal helper function that constrained requested items by the known total count.
src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs
src/BootstrapBlazor/Components/Select/Select.razor.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#7325 Fix Select and MultiSelect so that after using search (including in a dialog) and then clearing the search text, the full original option list is correctly reloaded and displayed (no placeholder/list retention issues).

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ArgoZhang ArgoZhang merged commit 81ea9d1 into main Jan 25, 2026
7 checks passed
@ArgoZhang ArgoZhang deleted the fix-select branch January 25, 2026 06:26
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The LoadItems implementations in Select and MultiSelect are now identical; consider extracting this shared logic into a common helper or base class method to reduce duplication and keep future behavioral fixes in one place.
  • By removing GetCountByTotal you’re fully trusting ItemsProviderRequest.Count; if any data providers return fewer items than requested without correctly setting TotalCount, this could cause unexpected behavior, so it may be worth adding a brief comment explaining that this assumption is intentional and aligned with Virtualize’s contract.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `LoadItems` implementations in `Select` and `MultiSelect` are now identical; consider extracting this shared logic into a common helper or base class method to reduce duplication and keep future behavioral fixes in one place.
- By removing `GetCountByTotal` you’re fully trusting `ItemsProviderRequest.Count`; if any data providers return fewer items than requested without correctly setting `TotalCount`, this could cause unexpected behavior, so it may be worth adding a brief comment explaining that this assumption is intentional and aligned with `Virtualize`’s contract.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Jan 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (38ea0d9) to head (12a67fb).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7581   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          749       749           
  Lines        32976     32972    -4     
  Branches      4580      4576    -4     
=========================================
- Hits         32976     32972    -4     
Flag Coverage Δ
BB 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes a bug where the placeholder text was incorrectly retained in Select and MultiSelect components when search text was cleared during virtualization. The issue occurred when users typed a search term, then deleted it - the placeholder would remain visible instead of showing the full list of items.

Changes:

  • Simplified the LoadItems method in Select and MultiSelect components by removing conditional count logic
  • Removed the GetCountByTotal helper method that was causing incorrect item count requests after search text was cleared
  • Updated package version from 10.2.3-beta03 to 10.2.3 (release version)

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/BootstrapBlazor/Components/Select/Select.razor.cs Removed conditional count logic in LoadItems that caused placeholder issues when search was cleared
src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs Applied same fix as Select component to ensure consistent behavior
src/BootstrapBlazor/BootstrapBlazor.csproj Bumped version to 10.2.3 release version

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{
var count = !string.IsNullOrEmpty(SearchText) ? request.Count : GetCountByTotal();
var data = await OnQueryAsync(new() { StartIndex = request.StartIndex, Count = count, SearchText = SearchText });
var data = await OnQueryAsync(new() { StartIndex = request.StartIndex, Count = request.Count, SearchText = SearchText });
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

The same conditional count logic that was removed here still exists in SelectGeneric.razor.cs (line 318) and MultiSelectGeneric.razor.cs (line 348). If this fix resolves the placeholder issue in Select and MultiSelect, the same fix should be applied to SelectGeneric and MultiSelectGeneric components for consistency and to prevent the same bug from occurring there.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(Select): 弹窗中 Select 或 MultiSelect 组件开启搜索选项导致占位符保留问题

2 participants