-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
MudTextField: Fix double validation on blur (#7034) #8121
Conversation
@henon, this PR complements a precedent PR that you contribute. |
@vernou Thanks for the PR. Your test is failing. |
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.
OK, straight forward and simple. Change looks good.
I don't get why the test doesn't work on the CI, I guess it works locally?
To get an understanding why the test fails on the CI you could temporarily add some Console.WriteLines in key locations to figure out what happens and wheter or not this is a timing issue or not
Hmm on second thought, wouldn't this prevent validation entirely because it is et before the call? |
Yes, it's work locally. It's a parallelization problem and the check is done before the validation.
No, because when _validated = true;
await base.ValidateValue(); |
I am not sure we should be adding delays to make tests past. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #8121 +/- ##
==========================================
+ Coverage 88.11% 88.12% +0.01%
==========================================
Files 394 394
Lines 11760 11760
Branches 2384 2384
==========================================
+ Hits 10362 10364 +2
Misses 871 871
+ Partials 527 525 -2 ☔ View full report in Codecov by Sentry. |
@mikes-gh The first assert check the state has changed, so I modified the test in this way. Also the test didn't work, because it didn't wait before to check the validation isn't called a second time. |
Thanks for the contribution @vernou and sorry, the PR slipped my mind. |
…or#8121) * MudTextField: Fix double validation on blur * Remove double _validated set to true
Description
In the precedent PR #7996, we introduced a boolean "_validated" to know when the validation already occurred and to avoid multiple validation.
But "_validated" is set to true after the validation is finished. When the validation is async, it's possible to start multiple validation in parallel, before "_validated" is set to true.
Resolves #7034.
How Has This Been Tested?
I added a test that test when the validation is async.
The test fail without the fix.
Types of changes
Checklist:
dev
).