Skip to content

Commit

Permalink
fix(UUIFormControlMixin): dont call setAttribute in the constructor (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
JesmoDev authored Oct 11, 2024
1 parent 992d7f9 commit a7ca074
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/uui-base/lib/mixins/FormControlMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ export const UUIFormControlMixin = <
public get pristine(): boolean {
return this._pristine;
}
private _pristine: boolean = true;
// Will be set to true instantly to trigger the setAttribute in the setter.
// This is to prevent an issue caused by using setAttribute in the constructor.
private _pristine: boolean = false;

/**
* Apply validation rule for requiring a value of this form control.
Expand Down Expand Up @@ -221,7 +223,7 @@ export const UUIFormControlMixin = <
constructor(...args: any[]) {
super(...args);
this._internals = this.attachInternals();
this.setAttribute('pristine', '');
this.pristine = true;

this.addValidator(
'valueMissing',
Expand Down

0 comments on commit a7ca074

Please sign in to comment.