Skip to content

Commit 51ae13d

Browse files
committed
ACP2E-2909: dynamic-rows.js:658 Uncaught TypeError: dataRecord.slice while editing bundle products
- Fixed the static test failure.
1 parent 7c7afcb commit 51ae13d

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

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

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,19 +141,13 @@ define([
141141
* @returns {Object} Chainable.
142142
*/
143143
initElements: function (data) {
144-
var newData = this.getNewData(data),
145-
recordIndex;
144+
var newData = this.getNewData(data);
146145

147146
this.parsePagesData(data);
148147

149148
if (newData.length) {
150149
if (this.insertData().length) {
151-
recordIndex = data.length - newData.length - 1;
152-
if (!isNaN(recordIndex)) {
153-
_.each(newData, function (newRecord) {
154-
this.processingAddChild(newRecord, ++recordIndex, newRecord[this.identificationProperty]);
155-
}, this);
156-
}
150+
this.parseProcessingAddChild(data, newData);
157151
}
158152
}
159153

@@ -182,6 +176,22 @@ define([
182176
this.reload();
183177
}
184178
}, this);
179+
},
180+
181+
/**
182+
* Processing add child if the record index is not a number.
183+
*
184+
* @param {Array} data
185+
* @param {Array} newData
186+
*/
187+
parseProcessingAddChild: function(data, newData) {
188+
let recordIndex;
189+
recordIndex = data.length - newData.length - 1;
190+
if (!isNaN(recordIndex)) {
191+
_.each(newData, function (newRecord) {
192+
this.processingAddChild(newRecord, ++recordIndex, newRecord[this.identificationProperty]);
193+
}, this);
194+
}
185195
}
186196
});
187197
});

0 commit comments

Comments
 (0)