mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
fix: invalidate cache only for the modified bitstream
(cherry picked from commit 4f48f39f7b
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
a7a7fa5511
commit
416bfedc66
@@ -163,12 +163,23 @@ export class BitstreamDataService extends IdentifiableDataService<Bitstream> imp
|
||||
sendRequest(this.requestService),
|
||||
take(1),
|
||||
).subscribe(() => {
|
||||
this.requestService.removeByHrefSubstring(bitstream.self + '/format');
|
||||
this.deleteFormatCache(bitstream);
|
||||
});
|
||||
|
||||
return this.rdbService.buildFromRequestUUID(requestId);
|
||||
}
|
||||
|
||||
private deleteFormatCache(bitstream: Bitstream) {
|
||||
const bitsreamFormatUrl = bitstream.self + '/format';
|
||||
this.requestService.setStaleByHrefSubstring(bitsreamFormatUrl);
|
||||
// Delete also cache by uuid as the format could be cached also there
|
||||
this.objectCache.getByHref(bitsreamFormatUrl).pipe(take(1)).subscribe((cachedRequest) => {
|
||||
const requestUuid = cachedRequest.requestUUIDs[0];
|
||||
if (this.requestService.hasByUUID(requestUuid)) {
|
||||
this.requestService.setStaleByUUID(requestUuid);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an observable of {@link RemoteData} of a {@link Bitstream}, based on a handle and an
|
||||
* optional sequenceId or filename, with a list of {@link FollowLinkConfig}, to automatically
|
||||
|
@@ -250,7 +250,7 @@ export class ItemEditBitstreamBundleComponent implements OnInit, OnDestroy {
|
||||
switchMap(() => this.bundleService.getBitstreams(
|
||||
this.bundle.id,
|
||||
paginatedOptions,
|
||||
followLink('format', { useCachedVersionIfAvailable: false }),
|
||||
followLink('format'),
|
||||
)),
|
||||
);
|
||||
}),
|
||||
|
Reference in New Issue
Block a user