Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Apr 30, 2025

Link issues

fixes #5928

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

Redesign the OnClear parameter for the Search component to simplify its usage and improve its behavior

New Features:

  • Modify OnClear event handler to remove the search text parameter

Bug Fixes:

  • Remove unnecessary state changes and simplify the clear button interaction

Enhancements:

  • Simplify the clear button click logic in the Search component
  • Update the clear click method to automatically trigger search after clearing

@ArgoZhang ArgoZhang requested a review from Copilot April 30, 2025 07:22
@bb-auto bb-auto bot added the enhancement New feature or request label Apr 30, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Apr 30, 2025

Reviewer's Guide

This pull request refactors the OnClear event callback in the Search component by changing its signature to Func<Task>? (removing the string? parameter) and updating the internal logic to clear the text before invoking the callback and triggering a search afterward. Usages and tests are updated accordingly. A minor unrelated change updates the EditorForm component's cascading value behavior.

File-Level Changes

Change Details Files
Refactored the OnClear parameter signature and invocation logic in the Search component.
  • Changed OnClear parameter type from Func<string?, Task>? to Func<Task>?.
  • Updated OnClearClick to call OnClear without arguments.
  • Modified OnClearClick to clear display text before invoking callback and trigger OnSearchClick after.
  • Updated consuming components and tests to use the new OnClear signature.
  • Removed unused OnClear handler from sample component.
src/BootstrapBlazor/Components/Search/Search.razor.cs
src/BootstrapBlazor.Server/Components/Pages/Coms.razor.cs
test/UnitTest/Components/SearchTest.cs
src/BootstrapBlazor.Server/Components/Samples/Searches.razor
src/BootstrapBlazor.Server/Components/Samples/Searches.razor.cs
Adjusted state change notification logic in the Search component.
  • Removed StateHasChanged() call from OnSearchClick.
  • Added StateHasChanged() call in TriggerFilter after OnSearchClick is invoked.
src/BootstrapBlazor/Components/Search/Search.razor.cs
Updated EditorForm component.
  • Set IsFixed to false on the _editorItems CascadingValue.
  • Refactored conditional rendering structure for group items.
src/BootstrapBlazor/Components/EditorForm/EditorForm.razor

Assessment against linked issues

Issue Objective Addressed Explanation
#5928 Redesign the OnClear parameter of the Search component.

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

@bb-auto bb-auto bot added this to the v9.5.0 milestone Apr 30, 2025
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 redesigns the OnClear parameter for the Search component, removing the string parameter in favor of a parameterless function to simplify the callback signature. Key changes include:

  • Updating the OnClear callback signature in Search.razor.cs and corresponding test and sample code.
  • Adjusting the OnClearClick behavior by replacing explicit reset logic with a call to OnSearchClick.
  • Modifying the cascading value update in EditorForm.razor by changing IsFixed from true to false.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/UnitTest/Components/SearchTest.cs Updated lambda signature to match the new parameterless OnClear callback.
src/BootstrapBlazor/Components/Search/Search.razor.cs Revised OnClear property signature and refactored OnClearClick to call OnClear without parameters and trigger search updates.
src/BootstrapBlazor/Components/EditorForm/EditorForm.razor Changed CascadingValue.IsFixed from true to false, potentially affecting UI update behavior.
src/BootstrapBlazor.Server/Components/Samples/Searches.razor.cs Removed obsolete OnClear method.
src/BootstrapBlazor.Server/Components/Samples/Searches.razor Removed OnClear callback from component usage.
src/BootstrapBlazor.Server/Components/Pages/Coms.razor.cs Updated OnClear method signature to be parameterless.
Comments suppressed due to low confidence (2)

src/BootstrapBlazor/Components/Search/Search.razor.cs:232

  • The explicit clearing of the search filter state (_filterItems) has been removed in OnClearClick. Confirm that calling OnSearchClick fully resets the search state as intended.
await OnClear();

src/BootstrapBlazor/Components/EditorForm/EditorForm.razor:6

  • [nitpick] Changing IsFixed from true to false may lead to more frequent updates of the cascading context. Verify that this change is intended for dynamic context updates.
<CascadingValue Value="@_editorItems" IsFixed="false">

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.

We encountered an error and are unable to review this PR. We have been notified and are working to fix it.

You can try again by commenting this pull request with @sourcery-ai review, or contact us for help.

@codecov
Copy link

codecov bot commented Apr 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (39d89de) to head (f483686).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #5929   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          665       665           
  Lines        30485     30485           
  Branches      4345      4345           
=========================================
  Hits         30485     30485           

☔ 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.

ArgoZhang and others added 2 commits April 30, 2025 15:28
# Conflicts:
#	src/BootstrapBlazor/BootstrapBlazor.csproj
@ArgoZhang ArgoZhang merged commit 0d9f89f into main Apr 30, 2025
5 checks passed
@ArgoZhang ArgoZhang deleted the feat-search branch April 30, 2025 07:34
ArgoZhang added a commit that referenced this pull request May 2, 2025
* refactor: 移除 RenderTemplate 提高性能

* refactor: 重构清空逻辑

* doc: 更新示例

* test: 更新单元测试

* chore: bump version 9.5.13

* chore: bump version 6.0

Co-Authored-By: zpmzuus <[email protected]>

---------

Co-authored-by: zpmzuus <[email protected]>
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(Search): redesign OnClear parameter

2 participants