Skip to content

Commit 4079a4f

Browse files
committed
revert FormState disableValidationWhen behavior
1 parent 16bdca4 commit 4079a4f

File tree

3 files changed

+0
-7
lines changed

3 files changed

+0
-7
lines changed

src/formState.spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -871,19 +871,16 @@ describe('FormState (mode: array) validation', () => {
871871
runInAction(() => options.disabled = true)
872872

873873
await state.validate()
874-
expect(state.$[0].hasError).toBe(false)
875874
expect(state.hasError).toBe(false)
876875
expect(state.error).toBeUndefined()
877876

878877
state.$[0].onChange('')
879878
await state.validate()
880-
expect(state.$[0].hasError).toBe(false)
881879
expect(state.hasError).toBe(false)
882880
expect(state.error).toBeUndefined()
883881

884882
runInAction(() => options.disabled = false)
885883
await delay()
886-
expect(state.$[0].hasError).toBe(true)
887884
expect(state.hasError).toBe(true)
888885
expect(state.error).toBe('empty')
889886

src/formState.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,6 @@ export default class FormState<TFields extends ValidatableFields, TValue = Value
239239
*/
240240
@action disableValidationWhen(predict: () => boolean) {
241241
this.shouldDisableValidation = predict
242-
this.fields.forEach(
243-
field => field.disableValidationWhen(predict)
244-
)
245242
return this
246243
}
247244

src/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export interface ComposibleValidatable<T, TValue = T> extends Validatable<T, TVa
4949
dirty: boolean
5050
_activated: boolean
5151
_validateStatus: ValidateStatus
52-
disableValidationWhen: (predict: () => boolean) => this
5352
}
5453

5554
/** Function to do dispose. */

0 commit comments

Comments
 (0)