vuestorefront / vue-storefront-1

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.
https://www.vuestorefront.io
MIT License
18 stars 13 forks source link

Products in multiple tabs crashing during cart interactions (using tab-cart-sync) #230

Closed bloodf closed 3 years ago

bloodf commented 3 years ago

From vue-storefront created by cewald: vuestorefront/vue-storefront#5719

Current behavior

I recently made a bugfix for the multi-tab cart-sync (#5711) and stumbled about the following bug:
If I open around 8 products from CLP in separat tabs and walk through this products and add them to cart after another, then – under Chrome – the tabs will freeze sooner or later or at least using an obscure amount of memory and CPU. This has a connection to the tabs-cart-sync using the storage window-event – if I disable this feature it won’t happen. There seems to be some kind of memory-leak or maybe one event calls the next mutation and causes an infinite loop. I can replicate this at our VSF but also at the VSF demo and others from the VSF showcase.

It only happens in Chrome and Chromium browsers on desktop environment – I can't trigger a crash on an iPad or iPhone either with mobile Chrome nor Safari.

Does anybody know something about this? Any help would be appreciated.

Expected behavior

The windows shouldn't crash obviously – to solve it we might need to have a marker in the storage that prevents the local-storage update and with that the event for the other tabs until the changes at the cart are final.

Steps to reproduce the issue

Version of Vue Storefront

Can you handle fixing this bug by yourself?

Which Release Cycle state this refers to? Info for developer. (doesn't apply to Next)

Pick one option.

Environment details

bloodf commented 3 years ago

Idk if anybody from VSF is looking into it. Some other memory-leaks forced me to stop my research – I'm trying to go back asap. If you have any new insights in the meantime let me know.

bloodf commented 3 years ago

We are also facing same issue. Can we fix this?