fix
This commit is contained in:
parent
2493ef51cc
commit
43bb9cde80
@ -50,7 +50,11 @@ public class RuleAnyRequiredModel: RulesProtocol {
|
||||
|
||||
if fieldValidity {
|
||||
return (fieldValidity, previousValidity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if the rule breaks all fields should be set to false
|
||||
fields.forEach { (formKey) in
|
||||
previousValidity[formKey] = false
|
||||
}
|
||||
return (valid: false, fieldValidity: previousValidity)
|
||||
|
||||
@ -32,7 +32,7 @@ public class RuleAnyValueChangedModel: RulesProtocol {
|
||||
for formKey in fields {
|
||||
guard let formField = fieldMolecules[formKey] else { continue }
|
||||
var fieldValidity = isValid(formField)
|
||||
// If past rule is invalid forr a field, the current rule should not flip the validity of a field
|
||||
// If past rule is invalid for a field, the current rule should not flip the validity of a field
|
||||
if let validity = previousFieldValidity[formKey], !validity, fieldValidity {
|
||||
fieldValidity = false
|
||||
}
|
||||
@ -40,6 +40,10 @@ public class RuleAnyValueChangedModel: RulesProtocol {
|
||||
if fieldValidity {
|
||||
return (true, previousValidity)
|
||||
}
|
||||
}
|
||||
|
||||
// if the rule breaks all fields should be set to false
|
||||
fields.forEach { (formKey) in
|
||||
previousValidity[formKey] = false
|
||||
}
|
||||
return (valid: false, fieldValidity: previousValidity)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user