From 10f5e056c8257f8b8fe954bfbc70d3c3daa7a8e3 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Mon, 11 Oct 2021 12:50:25 +0100 Subject: [PATCH] fix(search): :bug: Fixed an issue where changing the filter wouldn't refresh the search results --- src/Ombi/ClientApp/src/app/app.module.ts | 2 -- .../search-results/search-results.component.ts | 11 +++++------ .../src/app/discover/services/filter-service.ts | 3 ++- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Ombi/ClientApp/src/app/app.module.ts b/src/Ombi/ClientApp/src/app/app.module.ts index 1716b5c5e..ae4122eb7 100644 --- a/src/Ombi/ClientApp/src/app/app.module.ts +++ b/src/Ombi/ClientApp/src/app/app.module.ts @@ -19,7 +19,6 @@ import { CookieService } from "ng2-cookies"; import { CustomPageComponent } from "./custompage/custompage.component"; import { DataViewModule } from "primeng/dataview"; import { DialogModule } from "primeng/dialog"; -import { FilterService } from "./discover/services/filter-service"; import { JwtModule } from "@auth0/angular-jwt"; import { LandingPageComponent } from "./landingpage/landingpage.component"; import { LandingPageService } from "./services"; @@ -222,7 +221,6 @@ export function JwtTokenGetter() { MessageService, StorageService, RequestService, - FilterService, SignalRNotificationService, { provide: APP_BASE_HREF, diff --git a/src/Ombi/ClientApp/src/app/discover/components/search-results/search-results.component.ts b/src/Ombi/ClientApp/src/app/discover/components/search-results/search-results.component.ts index 02415a970..bef8bae03 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/search-results/search-results.component.ts +++ b/src/Ombi/ClientApp/src/app/discover/components/search-results/search-results.component.ts @@ -55,18 +55,17 @@ export class DiscoverSearchResultsComponent implements OnInit { public async ngOnInit() { this.isAdmin = this.authService.isAdmin(); - - if (this.advancedDataService) { - return; - } - this.loadingFlag = true; - this.filterService.onFilterChange.subscribe(async x => { if (!isEqual(this.filter, x)) { this.filter = { ...x }; await this.search(); } }); + + if (this.advancedDataService) { + return; + } + this.loadingFlag = true; } public async init() { diff --git a/src/Ombi/ClientApp/src/app/discover/services/filter-service.ts b/src/Ombi/ClientApp/src/app/discover/services/filter-service.ts index bceeb05d6..1dece0e27 100644 --- a/src/Ombi/ClientApp/src/app/discover/services/filter-service.ts +++ b/src/Ombi/ClientApp/src/app/discover/services/filter-service.ts @@ -1,7 +1,8 @@ import { EventEmitter, Injectable, Output } from "@angular/core"; + import { SearchFilter } from "../../my-nav/SearchFilter"; -@Injectable() +@Injectable({providedIn: 'root'}) export class FilterService { @Output() public onFilterChange = new EventEmitter();