Skip to content

Commit 05fce8b

Browse files
authored
Merge pull request #6080 from magento-performance/MC-37069
[PERFORMANCE] Configurable Products with large quantities of children cannot be opened
2 parents 40f9a4b + f85d984 commit 05fce8b

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,19 +219,18 @@ define([
219219
_.each(tmpData, function (row, index) {
220220
path = this.dataScope + '.' + this.index + '.' + (this.startIndex + index);
221221
row.attributes = $('<i></i>').text(row.attributes).html();
222-
row.sku = row.sku;
223222
this.source.set(path, row);
224223
}, this);
225224

226225
this.source.set(this.dataScope + '.' + this.index, data);
227226
this.parsePagesData(data);
228227

229228
// Render
230-
dataCount = data.length;
229+
dataCount = tmpData.length;
231230
elemsCount = this.elems().length;
232231

233232
if (dataCount > elemsCount) {
234-
this.getChildItems().each(function (elemData, index) {
233+
tmpData.each(function (elemData, index) {
235234
this.addChild(elemData, this.startIndex + index);
236235
}, this);
237236
} else {
@@ -243,6 +242,15 @@ define([
243242
this.generateAssociatedProducts();
244243
},
245244

245+
/**
246+
* Set initial property to records data
247+
*
248+
* @returns {Object} Chainable.
249+
*/
250+
setInitialProperty: function () {
251+
return this;
252+
},
253+
246254
/**
247255
* Parsed data
248256
*

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,13 +1126,17 @@ define([
11261126
* Update whether value differs from default value
11271127
*/
11281128
setDifferedFromDefault: function () {
1129-
var recordData = utils.copy(this.recordData());
1129+
var recordData;
11301130

1131-
Array.isArray(recordData) && recordData.forEach(function (item) {
1132-
delete item['record_id'];
1133-
});
1131+
if (this.default) {
1132+
recordData = utils.copy(this.recordData());
1133+
1134+
Array.isArray(recordData) && recordData.forEach(function (item) {
1135+
delete item['record_id'];
1136+
});
11341137

1135-
this.isDifferedFromDefault(!_.isEqual(recordData, this.default));
1138+
this.isDifferedFromDefault(!_.isEqual(recordData, this.default));
1139+
}
11361140
},
11371141

11381142
/**

dev/tests/js/jasmine/tests/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,9 @@ define([
4141
})
4242
};
4343

44-
model.getChildItems = jasmine.createSpy().and.returnValue($(''));
4544
model.source = sourceMock;
4645
model.processingUnionInsertData(mockData);
4746
expect(model.source.get).toHaveBeenCalled();
48-
expect(model.getChildItems).toHaveBeenCalled();
4947
expect(expectedData[1].sku).toBe('Conf&-sdfs');
5048
});
5149

0 commit comments

Comments
 (0)