71380: Remove redundant code and add subscribable removeByHrefSubstring

This commit is contained in:
Kristof De Langhe
2020-06-25 17:51:11 +02:00
parent 73c25998e3
commit bfdd943d45
4 changed files with 17 additions and 23 deletions

View File

@@ -201,8 +201,9 @@ export class RequestService {
* Remove all request cache providing (part of) the href
* This also includes href-to-uuid index cache
* @param href A substring of the request(s) href
* @return Returns an observable emitting whether or not the cache is removed
*/
removeByHrefSubstring(href: string) {
removeByHrefSubstring(href: string): Observable<boolean> {
this.store.pipe(
select(uuidsFromHrefSubstringSelector(requestIndexSelector, href)),
take(1)
@@ -213,6 +214,11 @@ export class RequestService {
});
this.requestsOnTheirWayToTheStore = this.requestsOnTheirWayToTheStore.filter((reqHref: string) => reqHref.indexOf(href) < 0);
this.indexStore.dispatch(new RemoveFromIndexBySubstringAction(IndexName.REQUEST, href));
return this.store.pipe(
select(uuidsFromHrefSubstringSelector(requestIndexSelector, href)),
map((uuids) => isEmpty(uuids))
);
}
/**