I have Store object structure as follows
{
"fooObject":[
{
"id":1,
"somefield":"bla bla",
"orderArray":[
{
"id":1,
"somefield":"a"
},
{
"id":2,
"somefield":"b"
},
{
"id":3,
"somefield":"c"
}
]
}
]
}
I need to make the orderArray empty on the NGRX reducer. and only need to change that array. I attempted to following to obtain my desired behavior but was unsuccessful.I tried using the Map method as well, but it failed.
on(ProductionLineAction.successSetInitialStateScheduledOrderLine, (state, action) => {
return {
...state,
fooObject: [
...state.productionLinesDisplayDetails,
{
orderArray: action.scheduledOrders
}
]
}
}),
The reducer will have frozen all the objects in the state tree so you'll have to create a new array with a new copy of the data.