MudAutocomplete: Coerce value immediately#10138
Conversation
|
If you will work on this, pls update your branch as we added nullable annotation to this component |
18b6b23 to
c3ae70a
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #10138 +/- ##
=======================================
Coverage 91.24% 91.24%
=======================================
Files 411 411
Lines 12495 12495
Branches 2434 2434
=======================================
Hits 11401 11401
Misses 552 552
Partials 542 542 ☔ View full report in Codecov by Sentry. |
Done. As this PR has breaking change, I want do more test before. |
|
@vernou Do you still want to do more tests or can this be merged? |
|
@vernou No, I finish to test. This is ready to be merged. |
|
If this fixes #9420 and that is considered a bug then I would say that this is not a breaking change per se. |
|
@henon , the PR modify the behavior. It fixes the bug is a side effect. The initial problem in #9420 was :
I see two solutions :
As the modification will be integrated in v8, it's the good time to implement the solution 1. |
|
Ping @henon |
|
I agree that it is a good time to do solution 1, adding this to the v8 migration guide. Thanks @vernou |
| <MudAutocomplete id="autocompleteLabelTest" T="string" Label="US States" | ||
| @bind-Value="Value" ResetValueOnEmptyText="ResetValueOnEmptyText" | ||
| SearchFunc="@SearchStates" DebounceInterval="DebounceInterval" | ||
| <MudAutocomplete id="autocompleteLabelTest" T="string?" Label="US States" |
There was a problem hiding this comment.
My IDE complains
The typeof operator cannot be used on a nullable reference type. (CS8639)
There was a problem hiding this comment.
Yeah, that's a bug dotnet/razor#8692. Razor generator breaks when you use ? with generic in razor syntax, which is why I added CS8669 as NoWarn. Seems like it a similar warring. But I think in that case you can revert the T="string?" to T="string" as the MudAutocomplete already specifies the value as T? rather than adding a new NoWarn.
It's pretty sad to see that the razor plays not really nicely with nullable
Co-authored-by: Artyom M. <[email protected]>



Description
Before this PR, the value is coerced after the search. But the search can be delayed, which also delays the coercing of value :

After this PR, the value is coerced immediately :

Fixes #9420
How Has This Been Tested?
I added test.
I checked the doc page
Type of Changes
Checklist
dev).