Skip to content

Commit

Permalink
chore: multi combobox. Empty dataSource leads to initially invalid fo…
Browse files Browse the repository at this point in the history
…rm in multi-combobox (#12446)

closes (#12427)[#12427]

## Description
- Fix formField priority state fallback value in CvaDirective
  • Loading branch information
khotcholava authored Sep 19, 2024
1 parent 1c23b2d commit 87325aa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libs/cdk/forms/cva/cva.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export class CvaDirective<T = any>
return 'default';
}

return this.formField?.getPriorityState() || 'error';
return this.formField?.getPriorityState() || 'default';
});

/**
Expand Down
13 changes: 9 additions & 4 deletions libs/core/multi-combobox/base-multi-combobox.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -537,13 +537,18 @@ export abstract class BaseMultiCombobox<T = any> {

/** @hidden */
protected _processingEmptyData(): void {
this.inputText = this._previousInputText;
if (this._cva.disabled) {
return;
}

this._setInvalidEntry();
if (this._cva.controlInvalid && this._cva.ngControl?.hasError) {
this._setInvalidEntry();

if (this._timerSub$) {
this._timerSub$.unsubscribe();
if (this._timerSub$) {
this._timerSub$.unsubscribe();
}
}
this.inputText = this._previousInputText;

this._timerSub$ = timer(this.invalidEntryDisplayTime).subscribe(() => this._unsetInvalidEntry());

Expand Down

0 comments on commit 87325aa

Please sign in to comment.