SAP / spartacus

Spartacus is a lean, Angular-based JavaScript storefront for SAP Commerce Cloud that communicates exclusively through the Commerce REST API.
Apache License 2.0
744 stars 389 forks source link

Load current cart after "Cart not found" for logged user #3592

Closed marlass closed 5 years ago

marlass commented 5 years ago

In #3478 we fixed the issue with an infinite loop. However, we can improve the UX, by loading the current cart after catching "Cart not found" error. This will help in some cases with cart synchronization, but it will be still possible to have multiple carts on one user account when using multiple devices/browsers.

Platonn commented 5 years ago

According to https://github.com/SAP/cloud-commerce-spartacus-storefront-docs/issues/203#issuecomment-510088647, i think we should avoid multiple carts for signed-in user. So for logged user we should always try to load exising cart (in case that on other device it has already been created). And we should also load it from backend before trying to create a new cart.

KateChuen commented 5 years ago

Tested it on dev17.

Then another get call for the cart is sent, and a successful response returned with no cart.

Screen Shot 2019-08-13 at 3 31 36 PM