Skip to content

Commit 5171542

Browse files
committed
ACP2E-3076: Error when deleting bundle options
1 parent c893121 commit 5171542

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ define([
5555
this.source.set(path, optionBaseData);
5656
this.source.set(path + '.bundle_button_proxy', []);
5757
this.source.set(path + '.bundle_selections', []);
58-
this.removeBundleItemsFromOption(idx);
58+
this.removeBundleItemsFromOption(idx); // would be best to remove the entire html, but see first if remove from data works
5959
_.each(rec['bundle_selections'], function (obj, index) {
6060
this.source.set(path + '.bundle_button_proxy' + '.' + index, rec['bundle_button_proxy'][index]);
6161
this.source.set(path + '.bundle_selections' + '.' + index, obj);
@@ -71,15 +71,8 @@ define([
7171
* @param {Number|String} index - element index
7272
*/
7373
removeBundleItemsFromOption: function (index) {
74-
var bundleSelections = registry.get(this.name + '.' + index + '.' + this.bundleSelectionsName),
75-
bundleSelectionsLength = (bundleSelections.elems() || []).length,
76-
i;
77-
78-
if (bundleSelectionsLength) {
79-
for (i = 0; i < bundleSelectionsLength; i++) {
80-
bundleSelections.elems()[0].destroy();
81-
}
82-
}
74+
let bundleSelections = registry.get(this.name + '.' + index + '.' + this.bundleSelectionsName);
75+
bundleSelections.destroyChildren();
8376
},
8477

8578
/**

app/code/Magento/Ui/view/base/web/js/dynamic-rows/dynamic-rows.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,10 @@ define([
655655

656656
startIndex = page || this.startIndex;
657657

658-
return dataRecord.slice(startIndex, this.startIndex + parseInt(this.pageSize, 10));
658+
if (dataRecord.length) {
659+
return dataRecord.slice(startIndex, this.startIndex + parseInt(this.pageSize, 10));
660+
}
661+
return [];
659662
},
660663

661664
/**

0 commit comments

Comments
 (0)