wp-calypso
wp-calypso copied to clipboard
Masterbar cart preserves open state after products are removed
Originally reported in https://github.com/Automattic/wp-calypso/pull/65180
To reproduce:
- Add a product to the cart and then manually visit
/domains/add/:site
. - Using the masterbar cart, remove the product from the cart.
- Once the masterbar cart disappears, immediately click to add a domain to the cart.
- Notice that the masterbar cart opens up on its own.
Expected behavior: the masterbar cart does not open until clicked.
From planning:
Lower priority, since most places in Calypso use the Checkout URL method to manage the cart. Should be a quick-ish fix though to update the state when the masterbar cart is hidden.
I see that state is updated with false value when the cart is hidden, but it doesn't reflect. Pleas find here:
https://github.com/Automattic/wp-calypso/blob/11a04f43d6c44bff2c8264418ce4fabd55db138d/client/layout/masterbar/masterbar-cart/masterbar-cart-button.tsx#L57
@michaeldcain I hope you seen above comment.
Thanks @halleshubham! That looks like a good place to try to fix this. Whoever picks up this issue can hopefully write a PR with that in mind!
I don't know if I got it right, by the previous comment I meant:
onClose event of the shopping cart - the state is already being updated - which should ideally be updating the component, isn't it ?
@sirbrillig @michaeldcain
Let me know what do you think, so that I can tryout fix ?
Let us check this out.
FWIW the issue is that, if the mini-cart is active, and you click to remove the last product, then the mini-cart and its button are hidden, but it remains active. So the next time there are items in the cart, it appears active immediately.