From 72c119347cd356f727ec3a7721bd5ed48baa01bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= Date: Thu, 19 May 2022 14:44:27 -0400 Subject: [PATCH 1/2] fix(search-results): prevent empty message to be shown during typing --- .../search-results-tool.component.html | 2 +- .../search-results-tool.component.ts | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/integration/src/lib/search/search-results-tool/search-results-tool.component.html b/packages/integration/src/lib/search/search-results-tool/search-results-tool.component.html index de51aa1602..6c5020e0f1 100644 --- a/packages/integration/src/lib/search/search-results-tool/search-results-tool.component.html +++ b/packages/integration/src/lib/search/search-results-tool/search-results-tool.component.html @@ -1,4 +1,4 @@ -
+

{{ 'igo.integration.searchResultsTool.noResults' | translate }}

{{ 'igo.integration.searchResultsTool.doSearch' | translate }}

diff --git a/packages/integration/src/lib/search/search-results-tool/search-results-tool.component.ts b/packages/integration/src/lib/search/search-results-tool/search-results-tool.component.ts index 729fab2037..b7dc5f0e0b 100644 --- a/packages/integration/src/lib/search/search-results-tool/search-results-tool.component.ts +++ b/packages/integration/src/lib/search/search-results-tool/search-results-tool.component.ts @@ -82,6 +82,9 @@ export class SearchResultsToolComponent implements OnInit, OnDestroy { private abstractFocusedResult: Feature; private abstractSelectedResult: Feature; + public debouncedEmpty$ :BehaviorSubject = new BehaviorSubject(true);; + private debouncedEmpty$$: Subscription; + /** * Store holding the search results * @internal @@ -246,6 +249,10 @@ export class SearchResultsToolComponent implements OnInit, OnDestroy { } }); }); + + this.debouncedEmpty$$ = this.store.stateView.empty$.pipe(debounceTime(1500)).subscribe(empty => + this.debouncedEmpty$.next(empty) + ) } private monitorResultOutOfView() { @@ -368,6 +375,9 @@ export class SearchResultsToolComponent implements OnInit, OnDestroy { if (this.getRoute$$) { this.getRoute$$.unsubscribe(); } + if (this.debouncedEmpty$$) { + this.debouncedEmpty$$.unsubscribe(); + } } /** From 52526cd094a9d94efe5e5d007decc11557063898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= Date: Thu, 19 May 2022 15:24:42 -0400 Subject: [PATCH 2/2] lint --- .../search-results-tool/search-results-tool.component.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/integration/src/lib/search/search-results-tool/search-results-tool.component.ts b/packages/integration/src/lib/search/search-results-tool/search-results-tool.component.ts index b7dc5f0e0b..93af942d6d 100644 --- a/packages/integration/src/lib/search/search-results-tool/search-results-tool.component.ts +++ b/packages/integration/src/lib/search/search-results-tool/search-results-tool.component.ts @@ -82,7 +82,7 @@ export class SearchResultsToolComponent implements OnInit, OnDestroy { private abstractFocusedResult: Feature; private abstractSelectedResult: Feature; - public debouncedEmpty$ :BehaviorSubject = new BehaviorSubject(true);; + public debouncedEmpty$ :BehaviorSubject = new BehaviorSubject(true); private debouncedEmpty$$: Subscription; /** @@ -249,10 +249,8 @@ export class SearchResultsToolComponent implements OnInit, OnDestroy { } }); }); - - this.debouncedEmpty$$ = this.store.stateView.empty$.pipe(debounceTime(1500)).subscribe(empty => - this.debouncedEmpty$.next(empty) - ) + + this.debouncedEmpty$$ = this.store.stateView.empty$.pipe(debounceTime(1500)).subscribe(empty => this.debouncedEmpty$.next(empty)); } private monitorResultOutOfView() {