Repository navigation
Add built-in support for async form validation in Blazor #66526
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
3fd9cac
Core implementation
oroztocil 93ac4ba
Catch non-cancellation exceptions in ValidateAsync, add form-level fa…
oroztocil 70fe8b8
Improve message clearing for cancelled/faulted async validations
oroztocil 4466ea8
Add cancellation token to EditContext.ValidateAsync
oroztocil e94d89a
Call NotifyValidationStateChanged when a pending validation task chan…
oroztocil b7d0131
Improve form-level pending/faulted state indication
oroztocil c8c7d5b
Document Validate/ValidateAsync as non-reentrant
oroztocil a109c82
Move completed task shortcircuiting into AddValidationTask, simplify …
oroztocil 0cd6936
Improve code comments
oroztocil 470b9b4
Simplify ValidateAsync
oroztocil e0a68d3
Add integration tests
oroztocil 7b362f8
Add pending/faulted CSS classes
oroztocil 6a2f955
Simplify FieldCssClassProvider
oroztocil 37e6752
Code review fixes
oroztocil 8aa6147
Code review fixes
oroztocil b3c1f59
Code review fixes
oroztocil 2ec6606
Move TryGetValidatablePropertyInfo to ValidationOptions
oroztocil e041968
Simplify DataAnnotationsEventSubscriptions, improve comments
oroztocil 7eb3b3a
Fix race condition in IsValidationPending, apply minor review fixes
oroztocil 3b2c305
Merge remote-tracking branch 'origin/main' into oroztocil/validation-…
oroztocil 3e24609
Merge remote-tracking branch 'origin/main' into oroztocil/validation-…
oroztocil 7a15fa3
Fix invalid parallelism in Blazor form validation tests
oroztocil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,14 @@ | ||
| #nullable enable | ||
| Microsoft.AspNetCore.Components.Forms.ValidationRequestedEventArgs.ValidationRequestedEventArgs(System.Threading.CancellationToken cancellationToken) -> void | ||
| Microsoft.AspNetCore.Components.Forms.ValidationRequestedEventArgs.CancellationToken.get -> System.Threading.CancellationToken | ||
| *REMOVED*static Microsoft.AspNetCore.Components.Forms.EditContextDataAnnotationsExtensions.AddDataAnnotationsValidation(this Microsoft.AspNetCore.Components.Forms.EditContext! editContext) -> Microsoft.AspNetCore.Components.Forms.EditContext! | ||
| *REMOVED*static Microsoft.AspNetCore.Components.Forms.EditContextDataAnnotationsExtensions.EnableDataAnnotationsValidation(this Microsoft.AspNetCore.Components.Forms.EditContext! editContext) -> System.IDisposable! | ||
| Microsoft.AspNetCore.Components.Forms.EditContext.OnValidationRequestedAsync -> System.Func<object!, Microsoft.AspNetCore.Components.Forms.ValidationRequestedEventArgs!, System.Threading.Tasks.Task!>? | ||
| Microsoft.AspNetCore.Components.Forms.EditContext.ValidateAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<bool>! | ||
| Microsoft.AspNetCore.Components.Forms.EditContext.AddValidationTask(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier, System.Threading.Tasks.Task! task, System.Threading.CancellationTokenSource! cts) -> void | ||
| Microsoft.AspNetCore.Components.Forms.EditContext.IsValidationPending(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) -> bool | ||
| Microsoft.AspNetCore.Components.Forms.EditContext.IsValidationPending<TField>(System.Linq.Expressions.Expression<System.Func<TField>!>! accessor) -> bool | ||
| Microsoft.AspNetCore.Components.Forms.EditContext.IsValidationPending() -> bool | ||
| Microsoft.AspNetCore.Components.Forms.EditContext.IsValidationFaulted(in Microsoft.AspNetCore.Components.Forms.FieldIdentifier fieldIdentifier) -> bool | ||
| Microsoft.AspNetCore.Components.Forms.EditContext.IsValidationFaulted<TField>(System.Linq.Expressions.Expression<System.Func<TField>!>! accessor) -> bool | ||
| Microsoft.AspNetCore.Components.Forms.EditContext.IsValidationFaulted() -> bool |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| #nullable enable | ||
| Microsoft.Extensions.Validation.ValidatableTypeInfo.GetProperty(string! propertyName) -> Microsoft.Extensions.Validation.ValidatablePropertyInfo? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.