Skip to content

Conversation

@sethidden
Copy link
Contributor

Before this commit if you - while logged in - added some new items to
the cart, then logged out, the cart store would still contain the full,
old cart object

This was caused by the useCart().clear() method patching the cart
store (similarly to useUser().setCart()), and it seems like there was a
race condition there. Please note .clear() re-downloads the cart

M2-831

@sethidden sethidden marked this pull request as draft June 23, 2022 09:30
@sethidden
Copy link
Contributor Author

The initial resolution doesn't work - clear() is necessary to add a new cart so it's possible to add products after logging out

there's logic inside clear() that creates a fresh cart if there's no
cart id

before this commit there seems to have been a race condition between
logout and clear
@sethidden sethidden force-pushed the M2-831-cart-is-not-cleared-after-log-out branch from 07bbd40 to a72af1e Compare June 23, 2022 10:30
@sethidden
Copy link
Contributor Author

Should be ok now

@sethidden sethidden marked this pull request as ready for review June 23, 2022 10:31
@Frodigo Frodigo added this to the 1.0.0-rc.10 milestone Jun 23, 2022
@sethidden sethidden merged commit fdd25db into develop Jun 23, 2022
@sethidden sethidden deleted the M2-831-cart-is-not-cleared-after-log-out branch June 23, 2022 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants