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

Clear parts of local storage after deployment #269

Open nhp opened 5 years ago

nhp commented 5 years ago

What is the motivation for adding / enhancing this feature?

There should be a possibility for targeted local storage flushing. Like after a deployment or rebuild this could be needed to have the current information available at the client side. Right now it is up to the user to do so and that is not really helpful for getting updated stuff out to the browser. If the user completely throws their local storage we need to take care of not accidentally clearing the cart information.

What are the acceptance criteria

Can you complete this feature request by yourself?

Which Release Cycle state this refers to? Info for developer.

Pick one option.

Additional information

According to w3c this is intended behavior as the user or the application is responsible for the local storage only. There is no TTL intended, but there are different options we found: https://stackoverflow.com/questions/2326943/when-do-items-in-html5-local-storage-expire but nothing seems "ready to use"

dennisotugo commented 5 years ago

+1

grimasod commented 5 years ago

I'm going to look into this. After a release, we often get enquiries from users who can't add items to the cart and experience other issues. Sometimes it's fixed by simply reloading the page. Other times we have to instruct them to clear their browser cache, which is not ideal.

As a first step, I'm thinking of showing an error alert with a button to reload the page. The message would be something like:

A new version of this website is available. Please click the button below to reload and update to the latest version.

dennisotugo commented 5 years ago

@pkarw How do you think this should be handled?

grimasod commented 5 years ago

This is a complicated issue. Even for just updating the service worker. See: https://redfin.engineering/how-to-fix-the-refresh-button-when-using-service-workers-a8e27af6df68

There's a possible solution for that, but it requires the completion of vuestorefront/vue-storefront#1589

filrak commented 5 years ago

Imho we can easily use Web Push or even API endpoint to inform users about new version and react accordingly. For sure it's a feature that we need in 1.11

pkarw commented 5 years ago

Related to storageQuota cleaning mechanism we already have in here: https://github.com/DivanteLtd/vue-storefront/blob/3d1d81c0e1aebfcdeda97ea7fec58b6d3ab8ef29/core/store/lib/storage.ts#L63

pkarw commented 5 years ago

Reopening, details: https://forum.vuestorefront.io/t/issue-clear-local-storage-after-deployment/589?u=pkarw

pkarw commented 5 years ago

We probably need to add a feature - kind of kill switch which is clearing out the localStorage; not sure how it should work; maybe - setting a localStorage hash with the current build number or hash - then in VS startup (app.ts) let’s check if it changed - if so: let’s programmatically clear the storage

haelbichalex commented 4 years ago

vuestorefront/vue-storefront#3650