You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a training project, I use Redux Toolkit with createEntityAdapter for a shopping cart function.
In the "addToCart" action, the item is added to the state using setOne or the quantity is increased using setOne.
In the "removeFromCart" action, it is first checked whether the item is contained in state.entities. If so, the quantity should be reduced by 1 using updateOne if the quantity is greater than 1. Otherwise, the item should be removed from the state using removeOne.
Everything works fine using npm run dev. Only when I test the shopping cart using Cypress Component Test is the item deleted from the shopping cart using the "removeFromCart" action, even if the quantity is greater than 1. The problem only occurs when I use updateOne.
In a training project, I use Redux Toolkit with createEntityAdapter for a shopping cart function.
In the "addToCart" action, the item is added to the state using setOne or the quantity is increased using setOne.
In the "removeFromCart" action, it is first checked whether the item is contained in state.entities. If so, the quantity should be reduced by 1 using updateOne if the quantity is greater than 1. Otherwise, the item should be removed from the state using removeOne.
Everything works fine using npm run dev. Only when I test the shopping cart using Cypress Component Test is the item deleted from the shopping cart using the "removeFromCart" action, even if the quantity is greater than 1. The problem only occurs when I use updateOne.
The text was updated successfully, but these errors were encountered: