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

fix(filter-field): Fixes an issue with validation flickering on free text. #1253

Merged
merged 1 commit into from
Jul 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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