adobe / asset-share-commons

A modern, open-source asset share reference implementation built on Adobe Experience Manager (AEM)
https://opensource.adobe.com/asset-share-commons/
Apache License 2.0
88 stars 107 forks source link

Asset Share Commons Cart Not Persistent Between Tabs Unless Page is Reload #660

Closed bobbymavrov closed 2 years ago

bobbymavrov commented 3 years ago

Describe the bug/suggestion When more than one tab is open with the ASC home page adding assets to the cart in one of the tabs does not get reflected on the other tabs unless those tabs have been reloaded by the user. This way adding assets to the Cart could be misleading since if the user does not refresh their current tab the assets added from other tabs would not appear in the Cart when they open it.

Environment AEM Version: 6.5.8 Asset Share Commons Version: 1.8 Author, Publish or both: Both

To Reproduce Open Home page on 2 tabs. Add assets to the Cart from the second tab. Navigate back to first tab. Open the Cart. The Cart would not show the added assets (unless the page is refreshed before that). The Cart icon would not show the correct number of assets in it the for the same reason. Add more assets from the first tab without refreshing it first. Refresh the page. Only assets from the current first tab are present in the cart.

Expected Behavior The Cart displaying all assets added from different tabs without refreshing the page. If the page has not been refreshed adding assets from one tab should not overwrite assets added from other tabs.

Additional context We tried using the other types of predefined ContextHub.store inside /apps/asset-share-commons/clientlibs/clientlib-contexthub/cart/store.assetsharecommonscart.js

by modifying: contextHub.Utils.inheritance.inherit(AssetShareCommonsCart, contextHub.Store.PersistedStore);

to SessionStore, JSONPStore and PersistedJSONPStore, but it did not change the behavior.

Thank you!

davidjgonzalez commented 2 years ago

FYI - i tried this on ASC 2.x and the only part that still holds try from your above description is the highlighted line:

  1. Open Home page on 2 tabs.
  2. Add assets to the Cart from the second tab.
  3. Navigate back to first tab.
  4. Open the Cart.
  5. The Cart would not show the added assets (unless the page is refreshed before that).
  6. The Cart icon would not show the correct number of assets in it the for the same reason. -> It shows zero until you refresh the page, or add/remove from the cart
  7. Add more assets from the first tab without refreshing it first.

Marking as wont fix since this is an old version (1.x) of ASC and its useable in 2.x without data loss.

If you have a fix you want to PR into the asset-share-commons-1.x branch we'd be happy to take a look and cut a release though.