-
-
Notifications
You must be signed in to change notification settings - Fork 362
fix(MultiSelect): keep last value when items is null #6924
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
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis change ensures the MultiSelect component clears its internal lastSelectedValueString when no items remain selected, preventing stale values from persisting when Items becomes null or empty. Class diagram for updated MultiSelect component logicclassDiagram
class MultiSelect {
- _currentValue : string
- SelectedItems : List<Item>
- Rows : List<Item>
- _lastSelectedValueString : string
+ OnParametersSet()
}
MultiSelect : OnParametersSet()
MultiSelect : _lastSelectedValueString is cleared when SelectedItems.Count == 0
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Pull Request Overview
This PR fixes a bug in the MultiSelect component where the last selected value was not being properly cleared when no items are available or selected. The fix ensures that when no items are selected, the internal _lastSelectedValueString field is reset to an empty string to maintain consistent state.
Key Changes
- Added a null check and reset logic for
_lastSelectedValueStringwhenSelectedItemsis empty
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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 there - I've reviewed your changes - here's some feedback:
- Add a null check for Rows before iterating to prevent NullReferenceExceptions when the items collection is null.
- Instead of unconditionally clearing _lastSelectedValueString when no items are selected, consider preserving its previous value to avoid losing user input if the list is temporarily empty.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Add a null check for Rows before iterating to prevent NullReferenceExceptions when the items collection is null.
- Instead of unconditionally clearing _lastSelectedValueString when no items are selected, consider preserving its previous value to avoid losing user input if the list is temporarily empty.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6924 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 740 740
Lines 31811 31815 +4
Branches 4468 4469 +1
=========================================
+ Hits 31811 31815 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Link issues
fixes #6921
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Bug Fixes: