Uncaught RangeError: Maximum call stack size exceeded while cloning a record

  • 1
  • Problem
  • Updated 2 years ago
  • Not a Problem
  • (Edited)
We are cloning and saving latest record from a model using a javascript snippet which is invoked on a button click. This functionality was working fine earlier and does not seem to work anymore with the latest release of skuid (Brooklyn Update 1 - Version # 9.5).

The error I get on console is "Uncaught RangeError: Maximum call stack size exceeded while cloning a record."  When I tried to pinpoint, the field it is choking on is - " __skuid_record__" Looks like, it is getting into an infinite loop while copying that field from record to record.




When I updated snippet to exclude that field from copying i. e. if I add italicized code shown below to the snippet, it seems to work fine at this time but was wondering if we could get to the root cause? Any idea about what is going on? Any changes / suggestions for the javascript?

Thanks in advance for all the help! :)

============================== Snippet ============================

var params = arguments[0], $ = skuid.$;
// Get Model
var LSIModel = skuid.model.getModel('Offender_LSI');

// Get latest record
var row = LSIModel.data[0];

//Create new row in model
var newRow = LSIModel.createRow();

// Copy data
if (row) {
    var rowUpdates = {};
    $.each(row, function(fieldId, val) {
        if ((fieldId != 'attributes') && (val !== null) && (fieldId != 'Id') && (fieldId != '__skuid_record__')) {
            var modelField = LSIModel.getField(fieldId);
            if ((typeof val === 'object') || (modelField && modelField.createable)) {
                rowUpdates[fieldId] = val;
            }
        }
    });
    LSIModel.updateRow(newRow, rowUpdates);
    LSIModel.save();
}
Photo of Rupali G

Rupali G

  • 378 Points 250 badge 2x thumb

Posted 2 years ago

  • 1

Be the first to post a reply!