Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Select): not render UI sometime #4798

Merged
merged 11 commits into from
Dec 7, 2024
Merged

fix(Select): not render UI sometime #4798

merged 11 commits into from
Dec 7, 2024

Conversation

ArgoZhang
Copy link
Collaborator

@ArgoZhang ArgoZhang commented Dec 7, 2024

not render UI sometime

Summary of the changes (Less than 80 chars)

简单描述你更改了什么, 不超过80个字符;如果有关联 Issue 请在下方填写相关编号

Description

fixes #4765

Regression?

  • Yes
  • No

[If yes, specify the version the behavior has regressed from]

[是否影响老版本]

Risk

  • High
  • Medium
  • Low

[Justify the selection above]

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

Fix the rendering issue in the Select component by refactoring data handling and caching logic, and update unit tests to ensure correct behavior.

Bug Fixes:

  • Fix the issue where the Select component UI does not render correctly under certain conditions by refactoring the data handling logic.

Enhancements:

  • Refactor the Select component to improve data handling and caching, ensuring more efficient rendering and state management.

Tests:

  • Update unit tests for the Select component to cover new data handling logic and ensure correct behavior when search text changes.

@bb-auto bb-auto bot added the enhancement New feature or request label Dec 7, 2024
Copy link

sourcery-ai bot commented Dec 7, 2024

Reviewer's Guide by Sourcery

This PR refactors the Select component to improve its data management and UI rendering reliability. The implementation replaces the direct data source management with a more efficient caching mechanism and streamlines the item selection logic. The changes also improve the search functionality and virtual scrolling implementation.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Implemented a new caching mechanism for Select items
  • Added _itemsCache property to store computed items
  • Created Rows property to manage and cache item lists
  • Removed _dataSource list in favor of the new caching system
  • Added cache invalidation on parameter changes
src/BootstrapBlazor/Components/Select/Select.razor.cs
Refactored item selection and search functionality
  • Introduced SelectedRow property to manage item selection
  • Simplified search text handling logic
  • Improved virtual scrolling implementation
  • Removed ResetSelectedItem method in favor of more focused functions
src/BootstrapBlazor/Components/Select/Select.razor.cs
src/BootstrapBlazor/Components/Select/Select.razor
Updated UI rendering and event handling
  • Modified template to use SelectedRow instead of SelectedItem
  • Updated search input binding mechanism
  • Improved dropdown item rendering logic
src/BootstrapBlazor/Components/Select/Select.razor
Enhanced test coverage and sample code
  • Added new test cases for search functionality
  • Updated existing tests to handle async operations
  • Simplified sample code in Selects component
test/UnitTest/Components/SelectTest.cs
src/BootstrapBlazor.Shared/Components/Samples/Selects.razor.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#4765 Fix issue where changing select dropdown options doesn't work on first attempt

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.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a 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. You can also use
    this command to specify where the summary should be inserted.

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.0.0 milestone Dec 7, 2024
Copy link

codecov bot commented Dec 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (caa0a52) to head (10fe1b8).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #4798   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          620       620           
  Lines        27425     27415   -10     
  Branches      3925      3922    -3     
=========================================
- Hits         27425     27415   -10     

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

@ArgoZhang ArgoZhang merged commit f0302ee into main Dec 7, 2024
5 checks passed
@ArgoZhang ArgoZhang deleted the feat-select branch December 7, 2024 07:28
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.

bug(Select): 切换下拉框的选项不生效
1 participant