diff --git a/vendor/magento/module-catalog/view/frontend/web/js/product/provider.js b/vendor/magento/module-catalog/view/frontend/web/js/product/provider.js index c9f0f91..6880cce 100644 --- a/vendor/magento/module-catalog/view/frontend/web/js/product/provider.js +++ b/vendor/magento/module-catalog/view/frontend/web/js/product/provider.js @@ -98,17 +98,15 @@ define([ return; } + // Filter initial ids to remove "out of scope" and "outdated" data + this.ids( + this.filterIds(this.ids()) + ); this.initIdsListener(); this.idsMerger( this.idsStorage.get(), this.prepareDataFromCustomerData(customerData.get(this.identifiersConfig.namespace)()) ); - - if (!_.isEmpty(this.productStorage.data())) { - this.dataCollectionHandler(this.productStorage.data()); - } else { - this.productStorage.setIds(this.data.currency, this.data.store, this.ids()); - } }, /** @@ -176,7 +174,7 @@ define([ if (!_.isEmpty(data)) { this.ids( - this.filterIds(_.extend(this.ids(), data)) + this.filterIds(_.extend(utils.copy(this.ids()), data)) ); } }, diff --git a/vendor/magento/module-catalog/view/frontend/web/js/product/storage/data-storage.js b/vendor/magento/module-catalog/view/frontend/web/js/product/storage/data-storage.js index 3dc9f3e..ad5976e 100644 --- a/vendor/magento/module-catalog/view/frontend/web/js/product/storage/data-storage.js +++ b/vendor/magento/module-catalog/view/frontend/web/js/product/storage/data-storage.js @@ -149,7 +149,7 @@ define([ if (data.items && ids.length) { //we can extend only items data = data.items; - this.data(_.extend(data, currentData)); + this.data(_.extend(currentData, data)); } }, @@ -271,13 +271,9 @@ define([ sentDataIds = _.keys(this.request.data); currentDataIds = _.keys(ids); - _.each(currentDataIds, function (id) { - if (_.lastIndexOf(sentDataIds, id) === -1) { - return false; - } + return _.every(currentDataIds, function (id) { + return _.lastIndexOf(sentDataIds, id) !== -1; }); - - return true; } return false;