Skip to content

Commit 49dad05

Browse files
committed
trungvose#54 - Using startWith for emiting the first value
1 parent 6dc4f44 commit 49dad05

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

frontend/src/app/project/components/search/search-drawer/search-drawer.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ProjectQuery } from '@trungk18/project/state/project/project.query';
66
import { IssueUtil } from '@trungk18/project/utils/issue';
77
import { NzDrawerRef } from 'ng-zorro-antd/drawer';
88
import { combineLatest, Observable, of } from 'rxjs';
9-
import { map, switchMap, debounceTime } from 'rxjs/operators';
9+
import { map, switchMap, debounceTime, startWith } from 'rxjs/operators';
1010
import { NzModalService } from 'ng-zorro-antd/modal';
1111
import { IssueModalComponent } from '../../issues/issue-modal/issue-modal.component';
1212

@@ -32,7 +32,7 @@ export class SearchDrawerComponent implements OnInit {
3232
) {}
3333

3434
ngOnInit(): void {
35-
let search$ = this.searchControl.valueChanges.pipe(debounceTime(50));
35+
let search$ = this.searchControl.valueChanges.pipe(debounceTime(50), startWith(this.searchControl.value));
3636
this.recentIssues$ = this._projectQuery.issues$.pipe(map((issues) => issues.slice(0, 5)));
3737
this.results$ = combineLatest([search$, this._projectQuery.issues$]).pipe(
3838
untilDestroyed(this),
96.1 KB
Loading
200 KB
Loading

0 commit comments

Comments
 (0)