Skip to content

Commit 8c31c8f

Browse files
authored
Merge pull request #7381 from magento-gl/GL_Mainline_PR_06012022
Gl mainline pr 06012022
2 parents 7aa5fb1 + 88873ed commit 8c31c8f

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

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

Lines changed: 9 additions & 23 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,
@@ -32,22 +30,6 @@ define([
3230
url.setBaseUrl(window.BASE_URL);
3331
options.sectionLoadUrl = url.build('customer/section/load');
3432

35-
/**
36-
* Storage initialization
37-
*/
38-
function initStorage() {
39-
$.cookieStorage.setConf({
40-
path: '/',
41-
expires: new Date(Date.now() + parseInt(options.cookieLifeTime, 10) * 1000),
42-
samesite: 'lax'
43-
});
44-
storage = $.initNamespaceStorage('mage-cache-storage').localStorage;
45-
storageInvalidation = $.initNamespaceStorage('mage-cache-storage-section-invalidation').localStorage;
46-
}
47-
48-
// Initialize storage with default parameters to prevent JS errors while component still not initialized
49-
initStorage();
50-
5133
/**
5234
* @param {Object} invalidateOptions
5335
*/
@@ -234,7 +216,14 @@ define([
234216
/**
235217
* Storage init
236218
*/
237-
initStorage: initStorage,
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+
},
238227

239228
/**
240229
* Retrieve the list of sections that has expired since last page reload.
@@ -399,10 +388,7 @@ define([
399388
*/
400389
'Magento_Customer/js/customer-data': function (settings) {
401390
options = settings;
402-
403-
// re-init storage with a new settings
404391
customerData.initStorage();
405-
406392
invalidateCacheBySessionTimeOut(settings);
407393
invalidateCacheByCloseCookieSession();
408394
customerData.init();

0 commit comments

Comments
 (0)