-
-
Notifications
You must be signed in to change notification settings - Fork 999
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(module:select): Null option shows in SelectContent #2023
fix(module:select): Null option shows in SelectContent #2023
Conversation
fix: adds ValueOnClear tests
Well, I didn't have a look at the codes yet. From your description, I feel this solution makes things more complicated. As we discussed before, the basic logic for With a fallback strategy, when the value is:
That's all. And for most cases, we don't need a fallback strategy, which makes things as simple as I mentioned in the first paragraph. |
I am confused about what do you understand when you say "fallback strategy". Do you mean usage of I do not think my solution is that complex. What it does handle is possible later inclusion of an item with its value set to I do understand you are probably addressing the conversation we had in PR #1906. I read the whole thing again before I posted this PR. To apply all what we established in that discussion would mean a serious refactoring of the |
Codecov Report
@@ Coverage Diff @@
## master #2023 +/- ##
==========================================
+ Coverage 27.57% 29.94% +2.37%
==========================================
Files 489 512 +23
Lines 32243 24635 -7608
Branches 0 238 +238
==========================================
- Hits 8890 7377 -1513
+ Misses 23353 17222 -6131
- Partials 0 36 +36
Continue to review full report at Codecov.
|
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.
internal void RemoveEqualityToNoValue(SelectOptionItem<TItemValue, TItem> option)
{
if (TypeDefaultExistsAsSelectOption)
{
TypeDefaultExistsAsSelectOption = IsOptionEqualToNoValue(option);
}
}
I still think here has a mistake.
Co-authored-by: Hao Sun <54608128+anranruye@users.noreply.github.com>
Hi, I think this PR breaks Two-way binding in Default mode while changing binded value to NULL.
Or am I doing something wrong and missing something? |
@jeffraska Yes, I can reproduce this. |
* fix(module:select): loads null in SelectOption into SelectContent fix: adds ValueOnClear tests * docs(module:select): add ValueOnChange * Update components/select/SelectBase.cs Co-authored-by: Hao Sun <54608128+anranruye@users.noreply.github.com> * other: clean-up warnings & add .Net foundation header Co-authored-by: Hao Sun <54608128+anranruye@users.noreply.github.com>
* fix(module:select): loads null in SelectOption into SelectContent fix: adds ValueOnClear tests * docs(module:select): add ValueOnChange * Update components/select/SelectBase.cs Co-authored-by: Hao Sun <54608128+anranruye@users.noreply.github.com> * other: clean-up warnings & add .Net foundation header Co-authored-by: Hao Sun <54608128+anranruye@users.noreply.github.com>
* fix(module:select): loads null in SelectOption into SelectContent fix: adds ValueOnClear tests * docs(module:select): add ValueOnChange * Update components/select/SelectBase.cs Co-authored-by: Hao Sun <54608128+anranruye@users.noreply.github.com> * other: clean-up warnings & add .Net foundation header Co-authored-by: Hao Sun <54608128+anranruye@users.noreply.github.com>
馃 This is a ...
馃敆 Related issue link
Fixes #1587
Addresses issues mentioned in this comment.
Addresses proposal in this comment.
馃挕 Background and solution
To fix the primary issue, in this PR I added a boolean that identifies if there is a
SelectOptionItem
that has itsValue
equal to the default value ofTItemValue
. I use that flag to figure out what to do when the value is selected and when theSelect
is cleared. On top of that, it also adds the parameterValueOnClear
which will be used as a primary value whenSelect
is cleared.ValueOnClear
may be set to a value that does not exist inSelectOptionItem
. In that case, theSelectContent
is cleared. Otherwise it is set to the existingSelectOptionItem
. I included test cases to cover for these scenarios (I think I cover all possibilities, at least until proven otherwise 馃槒).During my tests I found out we have some weird issues with
Select
. It seems it relies a lot on things happening during re-rendering. I am not a fan of this, as it splits responsibilities and is really hard to follow (and thus debug). In my opinion this makesSelect
more complex & less performant.馃摑 Changelog
[Parameter] ValueOnChange
- storedValue
that will be used when clear button is pressed鈽戯笍 Self Check before Merge