61142: RemoveByHrefSubstring fix

This commit is contained in:
Kristof De Langhe
2019-04-05 17:28:20 +02:00
parent 9f27a89dc4
commit 01b60dbf34
2 changed files with 3 additions and 4 deletions

View File

@@ -108,7 +108,7 @@ export class ItemRelationshipsComponent extends AbstractItemUpdateComponent {
// TODO: Fix lists refreshing correctly
this.objectCache.remove(this.item.self);
this.requestService.removeByHrefSubstring(this.item.self);
this.itemService.findById(this.item.id).pipe(getSucceededRemoteData(), take(1)).subscribe((itemRD: RemoteData<Item>) => this.item = itemRD.payload);
// this.itemService.findById(this.item.id).pipe(getSucceededRemoteData(), take(1)).subscribe((itemRD: RemoteData<Item>) => this.item = itemRD.payload);
this.initializeOriginalFields();
this.initializeUpdates();
this.notificationsService.success(this.getNotificationTitle('saved'), this.getNotificationContent('saved'));

View File

@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { createSelector, MemoizedSelector, select, Store } from '@ngrx/store';
import { Observable, race as observableRace } from 'rxjs';
import { filter, mergeMap, take } from 'rxjs/operators';
import { filter, map, mergeMap, take, tap } from 'rxjs/operators';
import { AppState } from '../../app.reducer';
import { hasValue, isNotEmpty } from '../../shared/empty.util';
@@ -64,8 +64,7 @@ const uuidsFromHrefSubstringSelector =
const getUuidsFromHrefSubstring = (state: IndexState, href: string): string[] => {
let result = [];
if (isNotEmpty(state)) {
result = Object.values(state)
.filter((value: string) => value.startsWith(href));
result = Object.keys(state).filter((key) => key.startsWith(href)).map((key) => state[key]);
}
return result;
};