Whenever I modify the quantity of an order item, does it result in creating a duplicate entry for that particular item in the state every time?
For instance, if the action.payload.indexNumber is 2 and action.payload.quantity is set to 100.
This snippet shows the code from orders.reducer.ts:
case OrderActions.CHANGE_QUANTITY: {
const entities = [
...state.entities,
{
...state.entities[action.payload.indexNumber],
quantity: action.payload.quantity}
];
return {
...state,
entities
};
}
Is there a way to avoid this duplication issue whenever I make changes to the quantity of an item?
I'd greatly appreciate any assistance on this matter. Thank you!