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

fix(combobox): Fixes an issue where the value was reset. #1445

Merged
merged 1 commit into from
Aug 13, 2020
Merged
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
10 changes: 7 additions & 3 deletions libs/barista-components/experimental/combobox/src/combobox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import {
switchMap,
startWith,
tap,
debounceTime,
} from 'rxjs/operators';
import {
CanDisable,
Expand Down Expand Up @@ -305,6 +306,7 @@ export class DtCombobox<T> extends _DtComboboxMixinBase
fromEvent(this._searchInput.nativeElement, 'input')
.pipe(
tap(() => this._autocompleteTrigger.openPanel()),
debounceTime(100),
map((event: KeyboardEvent): string => {
event.stopPropagation();
return this._searchInput.nativeElement.value;
Expand All @@ -314,9 +316,11 @@ export class DtCombobox<T> extends _DtComboboxMixinBase
.subscribe((query) => {
this.filterChange.emit(new DtComboboxFilterChange(query));
});
fromEvent(this._searchInput.nativeElement, 'blur').subscribe(() => {
this._resetInputValue();
});
fromEvent(this._searchInput.nativeElement, 'blur')
.pipe(takeUntil(this._destroy))
.subscribe(() => {
this._resetInputValue();
});
}

ngAfterContentInit(): void {
Expand Down