Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(search-results): prevent empty message to be shown during typing #1061

Merged
merged 2 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div *ngIf="!store || store.stateView.empty" style="margin: 10px;">
<div *ngIf="(!store || store.stateView.empty) && (debouncedEmpty$ | async) " style="margin: 10px;">
<section class="mat-typography">
<h4><strong>{{ 'igo.integration.searchResultsTool.noResults' | translate }}</strong></h4>
<p><strong>{{ 'igo.integration.searchResultsTool.doSearch' | translate }}</strong></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ export class SearchResultsToolComponent implements OnInit, OnDestroy {
private abstractFocusedResult: Feature;
private abstractSelectedResult: Feature;

public debouncedEmpty$ :BehaviorSubject<boolean> = new BehaviorSubject(true);
private debouncedEmpty$$: Subscription;

/**
* Store holding the search results
* @internal
Expand Down Expand Up @@ -246,6 +249,8 @@ export class SearchResultsToolComponent implements OnInit, OnDestroy {
}
});
});

this.debouncedEmpty$$ = this.store.stateView.empty$.pipe(debounceTime(1500)).subscribe(empty => this.debouncedEmpty$.next(empty));
}

private monitorResultOutOfView() {
Expand Down Expand Up @@ -368,6 +373,9 @@ export class SearchResultsToolComponent implements OnInit, OnDestroy {
if (this.getRoute$$) {
this.getRoute$$.unsubscribe();
}
if (this.debouncedEmpty$$) {
this.debouncedEmpty$$.unsubscribe();
}
}

/**
Expand Down