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 the free-text submission.
Browse files Browse the repository at this point in the history
Quickly input free text submissions were ignored if the user was submitting the filter under the
defined debounceTime as we were only updating the value after the debounceTime.
We are now updating the value immediately, but we are handling the submission and necessary updates
to the component after the debounceTime expired.

Fixes #726
  • Loading branch information
tomheller committed Mar 24, 2020
1 parent 5138f3b commit 65ea920
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ test('should choose a freetext node with the mouse and submit the correct value
// Wait for a certain amout fo time to let the filterfield refresh
.wait(250)
// Send the correct value into the input field
.typeText(input, 'Custom selection', { speed: 0.7 });
.typeText(input, 'Custom selection');

// Focus the filter field
await focusFilterFieldInput();
Expand Down
10 changes: 5 additions & 5 deletions libs/barista-components/filter-field/src/filter-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,16 +496,16 @@ export class DtFilterField<T>
// Using fromEvent instead of an html binding so we get a stream and can easily do a debounce
merge(
fromEvent(this._inputEl.nativeElement, 'input').pipe(
tap(() => (this._inputValue = this._inputEl.nativeElement.value)),
debounceTime(DT_FILTER_FIELD_TYPING_DEBOUNCE),
),
this._inputReset$,
this._inputReset$.pipe(
tap(() => (this._inputValue = this._inputEl.nativeElement.value)),
),
)
.pipe(
map(() => this._inputEl.nativeElement.value),
map(() => this._inputValue),
distinctUntilChanged(),
tap(value => {
this._inputValue = value;
}),
takeUntil(this._destroy$),
)
.subscribe(() => {
Expand Down

0 comments on commit 65ea920

Please sign in to comment.