Skip to content

Commit

Permalink
feat(search): decrease latency
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarbeau committed Aug 23, 2019
1 parent a77a2db commit 7d87907
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export class SearchBarComponent implements OnInit, OnDestroy {
this.stream$$ = this.stream$
.pipe(
debounce((term: string) => {
return term === '' ? EMPTY : timer(300);
return term === '' ? EMPTY : timer(200);
}),
distinctUntilChanged()
)
Expand Down Expand Up @@ -236,8 +236,10 @@ export class SearchBarComponent implements OnInit, OnDestroy {
}

this.term = term;
if (term.replace(/(#[^\s]*)/g, '').trim().length >= this.minLength ||
term.replace(/(#[^\s]*)/g, '').trim().length === 0) {
if (
term.replace(/(#[^\s]*)/g, '').trim().length >= this.minLength ||
term.replace(/(#[^\s]*)/g, '').trim().length === 0
) {
this.stream$.next(term);
}
}
Expand Down

0 comments on commit 7d87907

Please sign in to comment.