-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
MudAutocomplete: Coerce value immediately #10138
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
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My IDE complains
The typeof operator cannot be used on a nullable reference type. (CS8639)
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.
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).