fix: invalidate cache only for the modified bitstream

This commit is contained in:
Jesiel Viana
2025-04-24 07:43:05 -03:00
parent 6001652101
commit 4f48f39f7b
2 changed files with 14 additions and 3 deletions

View File

@@ -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

View File

@@ -246,7 +246,7 @@ export class ItemEditBitstreamBundleComponent implements OnInit, OnDestroy {
switchMap(() => this.bundleService.getBitstreams(
this.bundle.id,
paginatedOptions,
followLink('format', { useCachedVersionIfAvailable: false }),
followLink('format'),
)),
);
}),