From bbbc74a86b84c2db34355ec1fbfafc7e6dced6d3 Mon Sep 17 00:00:00 2001 From: amadulhaxxani Date: Mon, 23 Nov 2026 15:59:42 +0100 Subject: [PATCH] fix: reload list after workflow action re-run the search without cache on contentChange so the count adn the next workflow task show up right after claim/approve/reject --- .../shared/search/search.component.spec.ts | 19 +++++++++++++++++++ src/app/shared/search/search.component.ts | 6 ++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/app/shared/search/search.component.spec.ts b/src/app/shared/search/search.component.spec.ts index 05d4fc6b855..010b9cbb6a1 100644 --- a/src/app/shared/search/search.component.spec.ts +++ b/src/app/shared/search/search.component.spec.ts @@ -300,6 +300,25 @@ describe('SearchComponent', () => { expect(comp.resultFound.emit).toHaveBeenCalledWith(expectedResults); })); + it('should use the cached version for a normal search', fakeAsync(() => { + fixture.detectChanges(); + tick(100); + expect((searchServiceStub.search as jasmine.Spy).calls.mostRecent().args[2]).toBe(true); + })); + + it('should re-run the search without cache and refresh filters on content change', fakeAsync(() => { + fixture.detectChanges(); + tick(100); + spyOn(comp.refreshFilters, 'next'); + + comp.onContentChange(null); + + const searchArgs = (searchServiceStub.search as jasmine.Spy).calls.mostRecent().args; + expect(searchArgs[0]).toEqual(jasmine.objectContaining({ configuration: 'default' })); + expect(searchArgs[2]).toBe(false); + expect(comp.refreshFilters.next).toHaveBeenCalledWith(true); + })); + describe('when the open sidebar button is clicked in mobile view', () => { beforeEach(() => { diff --git a/src/app/shared/search/search.component.ts b/src/app/shared/search/search.component.ts index 5d56ccf830b..b5890af3b72 100644 --- a/src/app/shared/search/search.component.ts +++ b/src/app/shared/search/search.component.ts @@ -434,6 +434,7 @@ export class SearchComponent implements OnDestroy, OnInit { * @param $event */ public onContentChange($event: any) { + this.retrieveSearchResults(this.lastSearchOptions, false); this.retrieveFilters(this.lastSearchOptions); this.refreshFilters.next(true); } @@ -470,9 +471,10 @@ export class SearchComponent implements OnDestroy, OnInit { /** * Retrieve search result by the given search options * @param searchOptions + * @param useCachedVersionIfAvailable * @protected */ - protected retrieveSearchResults(searchOptions: PaginatedSearchOptions) { + protected retrieveSearchResults(searchOptions: PaginatedSearchOptions, useCachedVersionIfAvailable = this.useCachedVersionIfAvailable) { this.resultsRD$.next(null); this.lastSearchOptions = searchOptions; let followLinks = [ @@ -498,7 +500,7 @@ export class SearchComponent implements OnDestroy, OnInit { this.service.search( searchOptionsWithHidden, undefined, - this.useCachedVersionIfAvailable, + useCachedVersionIfAvailable, true, ...followLinks ).pipe(getFirstCompletedRemoteData())