I'm trying to update or rather insert new value into dictionary under ngrx Entity.
Here is simplified view of Entity:
interface Dictionary<T> { [key: number]: T }
export class Item {
id: number;
partsDescriptions: Dictionary<string[]>;
}
export interface ItemsState extends EntityState<Item> {
}
Here is app state:
export interface AppState {
items: ItemsState
}
In reducer I'm trying to do following:
on(MyActions.partDescriptionsLoaded, (state, action) => {
return {
...state,
items: adapter.updateOne({
id: action.id,
changes: {
...state.items[action.id],
partsDescriptions: {
...(state.items[action.id] && state.items[action.id].partsDescriptions),
[action.partId]: action.partDescriptions
}
}
}, state.items)
}
})
PartDescriptions dictionary is not extended, it's always replaced. Do you have any idea how to solve this issue?