Skip to content

Commit 84a36b5

Browse files
committed
MAGETWO-58251: PayPal Best Practice to Separate Saved Tokens
- refactored collections updater
1 parent 4828a0e commit 84a36b5

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

app/code/Magento/Ui/view/base/web/js/lib/core/collection.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,14 +269,12 @@ define([
269269
_.each(grouped, this.updateRegion, this);
270270

271271
_.each(this.regions, function (items) {
272-
var shouldBeEmpty = items.every(function (item) {
273-
return !~_elems.indexOf(item);
274-
});
272+
var hasObsoleteComponents = items().length && !_.intersection(_elems, items()).length;
275273

276-
if (shouldBeEmpty && items().length) {
274+
if (hasObsoleteComponents) {
277275
items.removeAll();
278276
}
279-
}, this);
277+
});
280278

281279
this.elems(_elems);
282280

0 commit comments

Comments
 (0)