mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
90252: Invalidate requests containing DSO on DataService.delete
Keep track of a list of request UUIDs in the object cache (most recent in front) When deleting a DSO, mark all of these as stale
This commit is contained in:
@@ -311,6 +311,21 @@ export class RequestService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark a request as stale
|
||||
* @param uuid the UUID of the request
|
||||
* @return an Observable that will emit true once the Request becomes stale
|
||||
*/
|
||||
setStaleByUUID(uuid: string): Observable<boolean> {
|
||||
this.store.dispatch(new RequestStaleAction(uuid));
|
||||
|
||||
return this.getByUUID(uuid).pipe(
|
||||
map(request => isStale(request.state)),
|
||||
filter(stale => stale === true),
|
||||
take(1),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a GET request is in the cache or if it's still pending
|
||||
* @param {GetRequest} request The request to check
|
||||
@@ -339,7 +354,7 @@ export class RequestService {
|
||||
.subscribe((entry: ObjectCacheEntry) => {
|
||||
// if the object cache has a match, check if the request that the object came with is
|
||||
// still valid
|
||||
inObjCache = this.hasByUUID(entry.requestUUID);
|
||||
inObjCache = this.hasByUUID(entry.requestUUIDs[0]);
|
||||
}).unsubscribe();
|
||||
|
||||
// we should send the request if it isn't cached
|
||||
|
Reference in New Issue
Block a user