ngrx 将对象添加到相同的 id

问题描述

我正在使用带套接字的 ngrx 存储,我想将我从后端接收到的所有数据存储在存储中。我现在正在使用 ngrx 实体适配器“upsertMany”,因此当新对象到达时,我将其注册到商店中,但之前的值将被删除


export const defaultPosition: PositionState = {
  ids: [],entities: {},loading: false,loaded: false,error: ""
};
  switch (action.type) {

    case positionActions.PositionActionTypes.LOAD_POSITIONS_SUCCESS: {
      return positionAdapter.upsertMany(action.payload,{
        ...state,loaded: true
      });
    } 
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)