Skip to content

Commit 703dccb

Browse files
[DURACOM-413] add cache invalidation on new version
1 parent 1c720dc commit 703dccb

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/app/core/data/version-data.service.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
2727
import { RemoteData } from './remote-data';
2828
import { RequestService } from './request.service';
29+
import { Item } from "@dspace/core/shared/item.model";
2930

3031
/**
3132
* Service responsible for handling requests related to the Version object
@@ -106,4 +107,14 @@ export class VersionDataService extends IdentifiableDataService<Version> impleme
106107
return this.patchData.createPatchFromCache(object);
107108
}
108109

110+
111+
/**
112+
* Invalidates the cache of the version link for this item.
113+
*
114+
* @param item
115+
*/
116+
invalidateVersionHrefCache(item: Item): void {
117+
this.requestService.setStaleByHrefSubstring(item._links.version.href);
118+
}
119+
109120
}

src/app/shared/dso-page/dso-versioning-modal-service/dso-versioning-modal.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export class DsoVersioningModalService {
8181
switchMap((newVersionItem: Item) => this.workspaceItemDataService.findByItem(newVersionItem.uuid, true, false)),
8282
getFirstSucceededRemoteDataPayload<WorkspaceItem>(),
8383
).subscribe((wsItem) => {
84+
this.versionService.invalidateVersionHrefCache(item);
8485
const wsiId = wsItem.id;
8586
const route = 'workspaceitems/' + wsiId + '/edit';
8687
this.router.navigateByUrl(route);

0 commit comments

Comments
 (0)