Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

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

bobbym33667819
Level 3
Level 3

We are using Assets Share Commons 1.8 (same behavior confirmed with 1.9.4) on AEM 6.5.8 and noticed the following behavior regarding the Cart functionality. When more than one tab is open on the ASC page adding assets to the cart in one of the tabs do not get reflected on the other tabs unless those tabs have been reloaded by the user. This way adding assets to Cart by a user could be misleading since if they don't refresh the tab they are currently on the assets added from other tabs would not appear when they access the cart.

 

 ASC uses ContextHub storage for the Cart defined in /apps/asset-share-commons/clientlibs/clientlib-contexthub/cart/store.assetsharecommonscart.js as:

 

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

.........

/** Register the ContextHub Store **/
contextHub.Utils.storeCandidates.registerStoreCandidate(
AssetShareCommonsCart,
CONTEXT_HUB_STORE_NAME,
0
);

 

We tried changing PersistedStore to SessionStore but that did not work at all on its own since the it did not preserve the Cart content when navigating even in the same tab. The other options like JSONPStore or PersistedJSONPStore also did help. 

 

The ContextHub store is then loaded via /apps/asset-share-commons/clientlibs/clientlib-site/js/cart/cart.js :

 

AssetShare.Cart = (function ($, ns, contextHubStore) {
"use strict";

function enabled() {
return contextHubStore !== null && typeof contextHubStore !== "undefined";
}

function getPaths() {
var assetsInCart = [],
paths = [];

if (enabled()) {
assetsInCart = contextHubStore.get();
}

 

Can you please guide us on how to modify the ContextHub store or the loading from it in order to have assets from all tabs reflected in the cart without reloading the page.

 

Thank you!

1 Accepted Solution
kishorekumar14
Correct answer by
Level 8
Level 8

Hi @bobbym33667819 ,

 

Could you please raise this concern in below link to validate the behavior.

https://github.com/adobe/asset-share-commons/issues/new/choose 

View solution in original post

1 Reply
kishorekumar14
Correct answer by
Level 8
Level 8

Hi @bobbym33667819 ,

 

Could you please raise this concern in below link to validate the behavior.

https://github.com/adobe/asset-share-commons/issues/new/choose 

View solution in original post