@@ -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