@@ -17,9 +17,7 @@ define([
17
17
] , function ( $ , _ , ko , sectionConfig , url ) {
18
18
'use strict' ;
19
19
20
- var options = {
21
- cookieLifeTime : 86400 //1 day by default
22
- } ,
20
+ var options = { } ,
23
21
storage ,
24
22
storageInvalidation ,
25
23
invalidateCacheBySessionTimeOut ,
@@ -32,22 +30,6 @@ define([
32
30
url . setBaseUrl ( window . BASE_URL ) ;
33
31
options . sectionLoadUrl = url . build ( 'customer/section/load' ) ;
34
32
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
-
51
33
/**
52
34
* @param {Object } invalidateOptions
53
35
*/
@@ -234,7 +216,14 @@ define([
234
216
/**
235
217
* Storage init
236
218
*/
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
+ } ,
238
227
239
228
/**
240
229
* Retrieve the list of sections that has expired since last page reload.
@@ -399,10 +388,7 @@ define([
399
388
*/
400
389
'Magento_Customer/js/customer-data' : function ( settings ) {
401
390
options = settings ;
402
-
403
- // re-init storage with a new settings
404
391
customerData . initStorage ( ) ;
405
-
406
392
invalidateCacheBySessionTimeOut ( settings ) ;
407
393
invalidateCacheByCloseCookieSession ( ) ;
408
394
customerData . init ( ) ;
0 commit comments