From 84a36b5773924c164059034b9d05a1b66f123385 Mon Sep 17 00:00:00 2001 From: Iurii Ivashchenko <iivashchenko@magento.com> Date: Wed, 12 Oct 2016 17:27:36 +0300 Subject: [PATCH] MAGETWO-58251: PayPal Best Practice to Separate Saved Tokens - refactored collections updater --- .../Magento/Ui/view/base/web/js/lib/core/collection.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/lib/core/collection.js b/app/code/Magento/Ui/view/base/web/js/lib/core/collection.js index 318179b7158..493b8c78f0c 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/core/collection.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/core/collection.js @@ -269,14 +269,12 @@ define([ _.each(grouped, this.updateRegion, this); _.each(this.regions, function (items) { - var shouldBeEmpty = items.every(function (item) { - return !~_elems.indexOf(item); - }); + var hasObsoleteComponents = items().length && !_.intersection(_elems, items()).length; - if (shouldBeEmpty && items().length) { + if (hasObsoleteComponents) { items.removeAll(); } - }, this); + }); this.elems(_elems); -- GitLab