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
This commit is contained in:

committed by
Tim Donohue

parent
8dbdb27c67
commit
eac787f1f4
@@ -137,12 +137,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
|
||||
|
@@ -203,7 +203,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