Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Jun 25, 2025

Link issues

fixes #6283

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

Add a new AutoSearchOnInput parameter to the Table component to enable automatic searches when the user types by wiring the search inputs to use Value/OnValueChanged with an InputEvent binding and invoking the search handler on input change.

New Features:

  • Introduce AutoSearchOnInput parameter on the Table component to toggle automatic search on input change.

Enhancements:

  • Update search input elements to use Value and OnValueChanged instead of @Bind, add UseInputEvent="AutoSearchOnInput" to trigger searches on typing.
  • Implement OnSearchTextValueChanged handler to update SearchText and invoke SearchClick automatically.

Tests:

  • Convert Table search unit tests to async, set AutoSearchOnInput in tests, and simulate both key and change events to verify search triggering.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jun 25, 2025

Reviewer's Guide

This PR adds an AutoSearchOnInput flag to the Table component so that searches fire automatically on each input change, refactors the search input markup to use explicit Value/OnValueChanged handlers with the new UseInputEvent setting, implements the corresponding change handler to trigger searches programmatically, and updates the unit tests to cover the new behavior.

Sequence diagram for search triggering with AutoSearchOnInput

sequenceDiagram
    participant User as actor User
    participant Table as Table<TItem>
    participant BootstrapInput

    User->>BootstrapInput: types in search box
    BootstrapInput-->>Table: OnValueChanged (if AutoSearchOnInput=true)
    Table->>Table: OnSearchTextValueChanged(value)
    Table->>Table: SearchClick()
    Table-->>User: Updates search results
Loading

File-Level Changes

Change Details Files
Introduce the AutoSearchOnInput parameter on the Table component
  • Added a bool AutoSearchOnInput [Parameter] with XML docs
  • Default value initialized to false
Table.razor.cs
Refactor search input markup to support input-event triggering
  • Replaced @bind-Value with explicit Value and OnValueChanged attributes
  • Added UseInputEvent="AutoSearchOnInput" on all search BootstrapInput instances
Table.razor
Implement OnSearchTextValueChanged to trigger automatic searches
  • Created async OnSearchTextValueChanged handler
  • Assigned new value to SearchText and invoked SearchClick()
Table.razor.Search.cs
Update unit tests to cover AutoSearchOnInput behavior
  • Changed OnSearchKeyUp_Ok test to async Task and awaited events
  • Set AutoSearchOnInput parameter in the test
  • Added Change event invocation to simulate input change
TableTest.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#6283 Implement an option to automatically trigger a search in the Table component after each change of the search field, providing a more responsive UI experience.

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 requested a review from Copilot June 25, 2025 06:48
@bb-auto bb-auto bot added the enhancement New feature or request label Jun 25, 2025
@bb-auto bb-auto bot added this to the 9.7.0 milestone Jun 25, 2025
@ArgoZhang ArgoZhang merged commit 560bb21 into main Jun 25, 2025
4 checks passed
@ArgoZhang ArgoZhang deleted the feat-table-search branch June 25, 2025 06:48
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 PR introduces the AutoSearchOnInput parameter to enable automatic search triggering when input values change, addressing issue #6283. The key changes include:

  • Converting the OnSearchKeyUp test method to asynchronous and adding a change event simulation.
  • Adding the AutoSearchOnInput parameter with accompanying documentation in Table.razor.cs.
  • Implementing a new OnSearchTextValueChanged method to trigger searches on input change and updating the BootstrapInput components accordingly.
  • Bumping the project version in the csproj file.

Reviewed Changes

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

Show a summary per file
File Description
test/UnitTest/Components/TableTest.cs Updated test method to async form and simulated additional change.
src/BootstrapBlazor/Components/Table/Table.razor.cs Added AutoSearchOnInput parameter with documentation.
src/BootstrapBlazor/Components/Table/Table.razor.Search.cs Introduced OnSearchTextValueChanged to trigger search on input change.
src/BootstrapBlazor/Components/Table/Table.razor Modified input components to use OnValueChanged and UseInputEvent.
src/BootstrapBlazor/BootstrapBlazor.csproj Incremented project version.
Comments suppressed due to low confidence (1)

test/UnitTest/Components/TableTest.cs:392

  • Consider adding a separate test case where AutoSearchOnInput is enabled to verify that the search is automatically triggered upon input changes.
                pb.Add(a => a.AutoSearchOnInput, false);

/// <returns></returns>
protected List<IFilterAction> GetSearches() => Columns.Where(col => col.GetSearchable()).ToSearches(SearchText);

private async Task OnSearchTextValueChanged(string? value)
Copy link

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

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

Since OnSearchTextValueChanged triggers a search on every input change when AutoSearchOnInput is enabled, consider debouncing the invocation of SearchClick to mitigate potential performance issues during rapid input.

Copilot uses AI. Check for mistakes.
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 @ArgoZhang - I've reviewed your changes and they look great!


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 Jun 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (29d02df) to head (88f8943).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #6306   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          714       714           
  Lines        31452     31457    +5     
  Branches      4438      4438           
=========================================
+ Hits         31452     31457    +5     
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(Table): auto search in Table after each change of search field

2 participants