-
-
Notifications
You must be signed in to change notification settings - Fork 323
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
refactor(AutoComplete): improved the TriggerChange/TriggerFilter method to update CurrentValue #5531
Conversation
fixes the same problem I was having in issue #5110
Reviewer's Guide by SourceryThis pull request addresses an issue where the input value in the AutoComplete component was being overwritten during filtering and change events. The changes ensure that the current input value is preserved and only updated when necessary, preventing unexpected behavior. Sequence diagram for TriggerFilter methodsequenceDiagram
participant AutoComplete
AutoComplete->>AutoComplete: Store current input value
AutoComplete->>AutoComplete: Filter items based on input value
AutoComplete->>AutoComplete: Take top DisplayCount items
AutoComplete->>AutoComplete: Set CurrentValue to currentInputValue
alt ValueChanged.HasDelegate is false
AutoComplete->>AutoComplete: StateHasChanged()
end
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Thanks for your PR, @celadaris. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @celadaris - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider extracting the conditional
StateHasChanged
call into a separate method to improve readability. - It looks like
TriggerChange
andTriggerFilter
have very similar logic - could this be refactored?
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5531 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 649 649
Lines 29599 29607 +8
Branches 4171 4173 +2
=========================================
+ Hits 29599 29607 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@microsoft-github-policy-service agree |
Link issues
[请在下方 # 后面填写相关 Issue 编号,如 #42]
fixes #5110
fixes #5532
Summary By Copilot
This pull request includes updates to the
BootstrapBlazor
project, focusing on upgrading the version and improving theAutoComplete
component. The most important changes include updating the project version, translating comments and documentation from Chinese to English, and enhancing theTriggerFilter
andTriggerChange
methods to prevent overwriting user input.Project version update:
src/BootstrapBlazor/BootstrapBlazor.csproj
: Updated the project version from9.4.6
to9.4.7-beta01
.Translations:
src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs
: Translated all comments and documentation from Chinese to English to improve code readability and maintainability. [1] [2] [3]Method enhancements:
src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs
: Enhanced theTriggerFilter
method to store the current input value and prevent it from being overwritten, and only triggerStateHasChanged
if no binding is present.src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs
: Improved theTriggerChange
method to updateCurrentValue
only if the value has actually changed, preventing overwriting the user's input.Regression?
[If yes, specify the version the behavior has regressed from]
[是否影响老版本]
Risk
[Justify the selection above]
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Fixes an issue where the input value in the AutoComplete component was being overwritten during filtering, preventing proper updates and maintaining the correct user input. The fix ensures that the CurrentValue is only updated if the value has actually changed and uses the current input value to prevent overwriting.
Bug Fixes: