mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[DURACOM-350] prevent unnecessary reload
(cherry picked from commit 1b112dd887
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
44f46a9a8a
commit
67d71e6da4
@@ -107,15 +107,19 @@ export abstract class MyDSpaceActionsComponent<T extends DSpaceObject, TService
|
||||
};
|
||||
// This assures that the search cache is empty before reloading mydspace.
|
||||
// See https://github.com/DSpace/dspace-angular/pull/468
|
||||
this.invalidateCacheForCurrentSearchUrl();
|
||||
this.invalidateCacheForCurrentSearchUrl(true);
|
||||
}
|
||||
|
||||
invalidateCacheForCurrentSearchUrl(): void {
|
||||
invalidateCacheForCurrentSearchUrl(shouldNavigate = false): void {
|
||||
const url = decodeURIComponent(this.router.url);
|
||||
this.searchService.getEndpoint().pipe(
|
||||
take(1),
|
||||
tap((cachedHref: string) => this.requestService.removeByHrefSubstring(cachedHref)),
|
||||
).subscribe(() => this.router.navigateByUrl(url));
|
||||
).subscribe(() => {
|
||||
if (shouldNavigate) {
|
||||
this.router.navigateByUrl(url);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user