wp-calypso icon indicating copy to clipboard operation
wp-calypso copied to clipboard

Masterbar cart preserves open state after products are removed

Open sirbrillig opened this issue 2 years ago • 6 comments

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.

sirbrillig avatar Jul 07 '22 16:07 sirbrillig

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.

michaeldcain avatar Jul 12 '22 17:07 michaeldcain

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

halleshubham avatar Jul 15 '22 21:07 halleshubham

@michaeldcain I hope you seen above comment.

halleshubham avatar Jul 16 '22 18:07 halleshubham

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!

sirbrillig avatar Jul 18 '22 17:07 sirbrillig

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 ?

halleshubham avatar Jul 18 '22 19:07 halleshubham

Let us check this out.

spraveenitpro avatar Aug 10 '22 22:08 spraveenitpro

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.

sirbrillig avatar Aug 15 '22 22:08 sirbrillig