Skip to content

Commit 1b112dd

Browse files
[DURACOM-350] prevent unnecessary reload
1 parent e84af6a commit 1b112dd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/app/shared/mydspace-actions/mydspace-actions.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,19 @@ export abstract class MyDSpaceActionsComponent<T extends DSpaceObject, TService
107107
};
108108
// This assures that the search cache is empty before reloading mydspace.
109109
// See https://github.com/DSpace/dspace-angular/pull/468
110-
this.invalidateCacheForCurrentSearchUrl();
110+
this.invalidateCacheForCurrentSearchUrl(true);
111111
}
112112

113-
invalidateCacheForCurrentSearchUrl(): void {
113+
invalidateCacheForCurrentSearchUrl(shouldNavigate = false): void {
114114
const url = decodeURIComponent(this.router.url);
115115
this.searchService.getEndpoint().pipe(
116116
take(1),
117117
tap((cachedHref: string) => this.requestService.removeByHrefSubstring(cachedHref)),
118-
).subscribe(() => this.router.navigateByUrl(url));
118+
).subscribe(() => {
119+
if (shouldNavigate) {
120+
this.router.navigateByUrl(url);
121+
}
122+
});
119123
}
120124

121125
/**

0 commit comments

Comments
 (0)