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:
@@ -163,12 +163,23 @@ export class BitstreamDataService extends IdentifiableDataService<Bitstream> imp
|
|||||||
sendRequest(this.requestService),
|
sendRequest(this.requestService),
|
||||||
take(1),
|
take(1),
|
||||||
).subscribe(() => {
|
).subscribe(() => {
|
||||||
this.requestService.removeByHrefSubstring(bitstream.self + '/format');
|
this.deleteFormatCache(bitstream);
|
||||||
});
|
});
|
||||||
|
|
||||||
return this.rdbService.buildFromRequestUUID(requestId);
|
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
|
* 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
|
* optional sequenceId or filename, with a list of {@link FollowLinkConfig}, to automatically
|
||||||
|
@@ -246,7 +246,7 @@ export class ItemEditBitstreamBundleComponent implements OnInit, OnDestroy {
|
|||||||
switchMap(() => this.bundleService.getBitstreams(
|
switchMap(() => this.bundleService.getBitstreams(
|
||||||
this.bundle.id,
|
this.bundle.id,
|
||||||
paginatedOptions,
|
paginatedOptions,
|
||||||
followLink('format', { useCachedVersionIfAvailable: false }),
|
followLink('format'),
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
Reference in New Issue
Block a user