replace multiple entities once
This commit is contained in:
parent
74fcbf080b
commit
17c65675b9
@ -79,10 +79,10 @@ export class EntitiesService<E extends IListable, I = E> extends GenericService<
|
||||
return this.all.some(entity => entity.id === id);
|
||||
}
|
||||
|
||||
replace(newEntity: E): void {
|
||||
const all = this.all.filter(item => item.id !== newEntity.id);
|
||||
all.push(newEntity);
|
||||
this.setEntities(all);
|
||||
this.entityChanged$.next(newEntity);
|
||||
replace(newEntities: E[]): void {
|
||||
const ids = newEntities.map(entity => entity.id);
|
||||
const all = this.all.filter(item => !ids.includes(item.id));
|
||||
this.setEntities([...all, ...newEntities]);
|
||||
newEntities.forEach(entity => this.entityChanged$.next(entity));
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ export class SortingService<T extends IListable> {
|
||||
return order === SortingOrders.asc ? result : result.reverse();
|
||||
}
|
||||
|
||||
return orderBy<T>(values, [column], [order]) as T[];
|
||||
return orderBy<T>(values, [column], [order]) ;
|
||||
}
|
||||
|
||||
setSortingOption(value: SortingOption<T>): void {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user