Skip to content

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 dynatrace-oss#1180
  • Loading branch information
tomheller authored and Yngrid Coello committed Nov 9, 2020
1 parent 0e91a4a commit ff5c4e5
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 ff5c4e5

Please sign in to comment.