Skip to content

Commit d08f710

Browse files
authored
Fix mage-cache-storage does not reflect to the change from system config value.
1 parent 8489c5b commit d08f710

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ define([
1717
], function ($, _, ko, sectionConfig, url) {
1818
'use strict';
1919

20-
var options = {
21-
cookieLifeTime: 86400 //1 day by default
22-
},
20+
var options = {},
2321
storage,
2422
storageInvalidation,
2523
invalidateCacheBySessionTimeOut,
@@ -33,12 +31,14 @@ define([
3331
options.sectionLoadUrl = url.build('customer/section/load');
3432

3533
function initStorage() {
36-
$.cookieStorage.setConf({
37-
path: '/',
38-
expires: new Date(Date.now() + parseInt(options.cookieLifeTime, 10) * 1000)
39-
});
40-
storage = $.initNamespaceStorage('mage-cache-storage').localStorage;
41-
storageInvalidation = $.initNamespaceStorage('mage-cache-storage-section-invalidation').localStorage;
34+
if (options.cookieLifeTime !== 'undefined') {
35+
$.cookieStorage.setConf({
36+
path: '/',
37+
expires: new Date(Date.now() + parseInt(options.cookieLifeTime, 10) * 1000)
38+
});
39+
storage = $.initNamespaceStorage('mage-cache-storage').localStorage;
40+
storageInvalidation = $.initNamespaceStorage('mage-cache-storage-section-invalidation').localStorage;
41+
}
4242
}
4343

4444
// Initialize storage with default parameters to prevent JS errors while component still not initialized

0 commit comments

Comments
 (0)