File tree Expand file tree Collapse file tree
src/Component/BlazorComponent/Components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,6 +87,11 @@ public void Register(IValidatable validatable)
8787 Validatables . Add ( validatable ) ;
8888 }
8989
90+ internal void Remove ( IValidatable validatable )
91+ {
92+ Validatables . Remove ( validatable ) ;
93+ }
94+
9095 private async Task HandleOnSubmitAsync ( EventArgs args )
9196 {
9297 var valid = Validate ( ) ;
@@ -279,9 +284,9 @@ public void Reset()
279284 {
280285 EditContext ? . MarkAsUnmodified ( ) ;
281286
282- foreach ( var validatable in Validatables )
287+ for ( int i = 0 ; i < Validatables . Count ; i ++ )
283288 {
284- validatable . Reset ( ) ;
289+ Validatables [ i ] . Reset ( ) ;
285290 }
286291
287292 _ = UpdateValue ( true ) ;
@@ -291,9 +296,9 @@ public void ResetValidation()
291296 {
292297 EditContext ? . MarkAsUnmodified ( ) ;
293298
294- foreach ( var validatable in Validatables )
299+ for ( int i = 0 ; i < Validatables . Count ; i ++ )
295300 {
296- validatable . ResetValidation ( ) ;
301+ Validatables [ i ] . ResetValidation ( ) ;
297302 }
298303
299304 _ = UpdateValue ( true ) ;
Original file line number Diff line number Diff line change @@ -517,6 +517,8 @@ protected override ValueTask DisposeAsyncCore()
517517 EditContext . OnValidationStateChanged -= HandleOnValidationStateChanged ;
518518 }
519519
520+ Form ? . Remove ( this ) ;
521+
520522 return base . DisposeAsyncCore ( ) ;
521523 }
522524 }
You can’t perform that action at this time.
0 commit comments