The open-source frontend for any eCommerce. Built with a PWA and headless approach, using a modern JS stack. We have custom integrations with Magento, commercetools, Shopware and Shopify and total coverage is just a matter of time. The API approach also allows you to merge VSF with any third-party tool like CMS, payment gateways or analytics. Newest updates: https://blog.vuestorefront.io. Always Open Source, MIT license.
From vue-storefront created by muhammad-abubakkar: vuestorefront/vue-storefront#5743
I am experiencing an unexpected behaviour when I have some items in cart and when I refresh cart page my items quantity get doubled. It doesn't happen every time but some times.
I think there is a race condition for cart/sync action call. Following are the two execution paths I found.
On load we are calling cart/load action after goes on to call cart/sync action with default value mergeQty: false
On load for logged in user after authentication, user/me action gets called and which goes on to call cart/authorize action in which we are calling cart/connect with mergeQty: true which then those on to cart/sync action with mergeQty:true and doubling the items in cart.
From vue-storefront created by muhammad-abubakkar: vuestorefront/vue-storefront#5743
I am experiencing an unexpected behaviour when I have some items in cart and when I refresh cart page my items quantity get doubled. It doesn't happen every time but some times.
I think there is a race condition for cart/sync action call. Following are the two execution paths I found.
cart/load
action after goes on to callcart/sync
action with default valuemergeQty: false
user/me
action gets called and which goes on to callcart/authorize
action in which we are callingcart/connect
withmergeQty: true
which then those on tocart/sync
action withmergeQty:true
and doubling the items in cart.There is an issue with this condition. What will happen if
serverItem.qty
andclientItem.qty
is same butmergeQty
istrue
. It will double the qty of item which can cause confusion. https://github.com/vuestorefront/vue-storefront/blob/e9d9f64f3f0467b435ec59d75ac9fb3e33283187/core/modules/cart/store/actions/mergeActions.ts#L85The only place where
mergeQty
is set astrue
is here. https://github.com/vuestorefront/vue-storefront/blob/e9d9f64f3f0467b435ec59d75ac9fb3e33283187/core/modules/cart/store/actions/connectActions.ts#L37I am sorry if I missed any updates or fixes.
I hope this makes sense. Please help fix this issue. Thanks.