Skip to content

Commit

Permalink
Revert validation optimization
Browse files Browse the repository at this point in the history
checkValidation should always fire the "validate" event, similar to how the native checkValidity always fires an "invalid" event.
  • Loading branch information
anhallbe committed Sep 12, 2024
1 parent cf0668c commit bd8edc9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 6 additions & 1 deletion doc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# What's New with Enterprise Web Components

## 1.6.0

### 1.6.0 Features

- `[Tabs]` Added validation error indicator ([#2793](https://github.com/infor-design/enterprise-wc/issues/2793))

## 1.5.1

### 1.5.1 Features
Expand Down Expand Up @@ -30,7 +36,6 @@
- `[Switch]` Added a label position setting that allows positioning the label on either the right or left side of the slider. ([#2579](https://github.com/infor-design/enterprise-wc/issues/2579))
- `[Themes]` Added a setting `IdsGlobal.themePath` that you can use to set the location of the theme files. ([#2125](https://github.com/infor-design/enterprise-wc/issues/2125))
- `[Themes]` Added latest round of semantic tokens. ([#2471](https://github.com/infor-design/enterprise-wc/issues/2471))
- `[Tabs]` Added validation error indicator ([#2793](https://github.com/infor-design/enterprise-wc/issues/2793))
- `[Validation]` Improved the validation message to prevent it from overflowing the field area. ([#2706](https://github.com/infor-design/enterprise-wc/issues/2706))

### 1.5.0 Fixes
Expand Down
5 changes: 1 addition & 4 deletions src/mixins/ids-validation-mixin/ids-validation-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ const IdsValidationMixin = <T extends Constraints>(superclass: T) => class exten
const checkRules = (input: any) => {
this.isTypeNotValid = {};
let isValid = true;
const wasValid = this.isValid;
const useRules = this.useRules.get(input);
useRules?.forEach((thisRule: any) => {
if (thisRule.rule !== undefined && !thisRule.rule?.check(input, this.rules) && this.isTypeNotValid) {
Expand All @@ -222,9 +221,7 @@ const IdsValidationMixin = <T extends Constraints>(superclass: T) => class exten
}
});
this.isTypeNotValid = null;
if (isValid !== wasValid) { // Only trigger if the state has changed, for performance.
this.#triggerValidateEvent(isValid);
}
this.#triggerValidateEvent(isValid);
};

if ((this as IdsInputInterface).input) {
Expand Down

0 comments on commit bd8edc9

Please sign in to comment.