Skip to content

Commit

Permalink
Fix (engine): skip validation of non-relevant nodes
Browse files Browse the repository at this point in the history
Note: no change to aggregation necessary! Derived state is awesome.
  • Loading branch information
eyelidlessness committed Jul 10, 2024
1 parent b14db09 commit f2cbd02
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ interface ValidationContextDefinition {
export interface ValidationContext extends EvaluationContext, SubscribableDependency {
readonly definition: ValidationContextDefinition;

isRelevant(): boolean;
isRequired(): boolean;
isBlank(): boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const createConstraintValidation = (
const message = createViolationMessage(context, 'constraintMsg', constraintMsg);

return createMemo(() => {
if (context.isBlank() || isValid()) {
if (!context.isRelevant() || context.isBlank() || isValid()) {
return constraintValid();
}

Expand Down Expand Up @@ -123,7 +123,7 @@ const createRequiredValidation = (
const message = createViolationMessage(context, 'requiredMsg', requiredMsg);

return createMemo(() => {
if (isValid()) {
if (!context.isRelevant() || isValid()) {
return requiredValid();
}

Expand Down

0 comments on commit f2cbd02

Please sign in to comment.