Skip to content

Commit 7e1857d

Browse files
authored
Merge pull request #4620 from magento-performance/MC-18190
[Performance] Remove dictionary from zxcvbn library & directory data fix
2 parents 087939f + 0d21dce commit 7e1857d

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

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

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,11 @@ define([
198198
* Customer data initialization
199199
*/
200200
init: function () {
201-
var countryData,
202-
privateContentVersion = 'private_content_version',
201+
var privateContentVersion = 'private_content_version',
203202
privateContent = $.cookieStorage.get(privateContentVersion),
204203
localPrivateContent = $.localStorage.get(privateContentVersion),
205204
needVersion = 'need_version',
206-
expiredSectionNames = this.getExpiredSectionNames(),
207-
isLoading = false;
205+
expiredSectionNames = this.getExpiredSectionNames();
208206

209207
if (privateContent &&
210208
!$.cookieStorage.isSet(privateContentVersion) &&
@@ -213,7 +211,6 @@ define([
213211
$.cookieStorage.set(privateContentVersion, needVersion);
214212
$.localStorage.set(privateContentVersion, needVersion);
215213
this.reload([], false);
216-
isLoading = true;
217214
} else if (localPrivateContent !== privateContent) {
218215
if (!$.cookieStorage.isSet(privateContentVersion)) {
219216
privateContent = needVersion;
@@ -224,7 +221,6 @@ define([
224221
buffer.notify(sectionName, sectionData);
225222
});
226223
this.reload([], false);
227-
isLoading = true;
228224
} else if (expiredSectionNames.length > 0) {
229225
_.each(dataProvider.getFromStorage(storage.keys()), function (sectionData, sectionName) {
230226
buffer.notify(sectionName, sectionData);
@@ -239,14 +235,6 @@ define([
239235
this.reload(storageInvalidation.keys(), false);
240236
}
241237
}
242-
243-
if (!_.isEmpty(privateContent)) {
244-
countryData = this.get('directory-data');
245-
246-
if (_.isEmpty(countryData()) && !isLoading) {
247-
customerData.reload(['directory-data'], false);
248-
}
249-
}
250238
},
251239

252240
/**
@@ -332,6 +320,9 @@ define([
332320
},
333321

334322
/**
323+
* Avoid using this function directly 'cause of possible performance drawbacks.
324+
* Each customer section reload brings new non-cached ajax request.
325+
*
335326
* @param {Array} sectionNames
336327
* @param {Boolean} forceNewSectionTimestamp
337328
* @return {*}

app/code/Magento/Customer/view/frontend/web/js/zxcvbn.js

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)