Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
fix(filter-field): Fixes an issue with validation flickering on free …
Browse files Browse the repository at this point in the history
…text.

Fixes #1180
  • Loading branch information
tomheller committed Jul 13, 2020
1 parent c19d7b6 commit 86b172d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface DtFilterFieldValidator {
export class DtFilterFieldControl extends FormControl {
constructor(private _validators: DtFilterFieldValidator[] = []) {
super(
null,
'',
_validators.map((validator) => validator.validatorFn),
null,
);
Expand Down
6 changes: 5 additions & 1 deletion libs/barista-components/filter-field/src/filter-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,11 @@ export class DtFilterField<T = any>

/** Write a value to the filter field control if there is a control active */
private _writeControlValue(value: string): void {
if (this._control) {
// Only write the value when it is actually different
// setting the value to it's old value and marking the control
// dirty will trigger validation too many times, resulting in a flickering
// of the validation flag.
if (this._control && this._control.value !== value) {
this._control.setValue(value);
this._control.markAsDirty();
this._control.markAsTouched();
Expand Down

0 comments on commit 86b172d

Please sign in to comment.