Skip to content

Commit d46adea

Browse files
committed
Merge remote-tracking branch 'origin/MC-36096' into 2.4-develop-pr36
2 parents b1ec397 + b10ce65 commit d46adea

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

app/code/Magento/Customer/view/frontend/web/js/customer-data.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ define([
3030
url.setBaseUrl(window.BASE_URL);
3131
options.sectionLoadUrl = url.build('customer/section/load');
3232

33-
//TODO: remove global change, in this case made for initNamespaceStorage
34-
$.cookieStorage.setConf({
35-
path: '/',
36-
expires: 1
37-
});
38-
39-
storage = $.initNamespaceStorage('mage-cache-storage').localStorage;
40-
storageInvalidation = $.initNamespaceStorage('mage-cache-storage-section-invalidation').localStorage;
41-
4233
/**
4334
* @param {Object} invalidateOptions
4435
*/
@@ -222,6 +213,18 @@ define([
222213
}
223214
},
224215

216+
/**
217+
* Storage init
218+
*/
219+
initStorage: function () {
220+
$.cookieStorage.setConf({
221+
path: '/',
222+
expires: new Date(Date.now() + parseInt(options.cookieLifeTime, 10) * 1000)
223+
});
224+
storage = $.initNamespaceStorage('mage-cache-storage').localStorage;
225+
storageInvalidation = $.initNamespaceStorage('mage-cache-storage-section-invalidation').localStorage;
226+
},
227+
225228
/**
226229
* Retrieve the list of sections that has expired since last page reload.
227230
*
@@ -357,6 +360,7 @@ define([
357360
*/
358361
'Magento_Customer/js/customer-data': function (settings) {
359362
options = settings;
363+
customerData.initStorage();
360364
invalidateCacheBySessionTimeOut(settings);
361365
invalidateCacheByCloseCookieSession();
362366
customerData.init();

0 commit comments

Comments
 (0)