У меня есть простое состояние:
export interface ItemsState{
items: Item[],
otherItem: OtherItem,
}
const initialState: ItemsState= {
items: [],
otherItem: {} as OtherItem,
}
И селектор:
const getItemFeatureState = createFeatureSelector<ItemsState>('items');
export const getItemValue= createSelector(
getItemFeatureState,
state => state.otherItem,
);
В моем компоненте я использую селектор:
public item: Item = {} as Item;
constructor(private itemsStore: Store<fromItem.State>) {
this.itemsStore.pipe(
select(fromItem.getItemValue),
distinctUntilChanged(),
).subscribe(item=> this.item = item);
}
Но когдаЯ обновляю этот локальный Item
, выполняя что-то простое, например:
this.item.value = someValue;
this.item.value
будет обновляться в ItemsState без использования Actions.
Как это возможно?