infor-design / enterprise

Enterprise-grade component library for the Infor Design System
https://design.infor.com
Apache License 2.0
134 stars 81 forks source link

Datagrid: Datagrid dies with Maximum call stack size exceeded #3759

Closed tmcconechy closed 4 years ago

tmcconechy commented 4 years ago

Describe the bug After upgrading when passing our column object to the datagrid the datagrid now crashes. We use GWT and it has a recursive object in it that seems to be failing on the newer deepCopy util

To Reproduce Steps to reproduce the behavior:

  1. Copy this zipped example to datagrid/test-recursive-object
  2. http://localhost:4000/components/datagrid/test-recursive-object
  3. Run page
  4. See error
  5. can also be reproduced if loading any page and running this odd script
    var x = {}
    x.y = x;
    Soho.utils.mergeSettings(window, y, {})

Expected behavior No errors. DeepCopy should somehow not loop on this.

Version

Platform

Additional context Ms Teams Infor SunSystems

Example Code


<div class="row">
  <div class="twelve columns">
    <div id="datagrid" class="datagrid">
    </div>
  </div>
</div>

<script id="datagrid-script">
  $('body').one('initialized', function () {

      var columns = [];

      $.getJSON('{{basepath}}api/datagrid-sample-data', function(res) {

        //Define Columns for the Grid.
        columns.push({ id: 'productId', hideable: false, name: 'Id', field: 'productId', formatter: Formatters.Text, width: 100});
        columns.push({ id: 'productName', name: 'Product Name', field: 'productName', formatter: Formatters.Hyperlink, width: 300, minWidth: 100});
        columns.push({ id: 'activity', name: 'Activity', field: 'activity'});
        columns.push({ id: 'hidden', hidden: true, name: 'Hidden', field: 'hidden'});
        columns.push({ id: 'price', align: 'right', name: 'Actual Price', field: 'price', formatter: Formatters.Decimal, numberFormat: {minimumFractionDigits: 0, maximumFractionDigits: 0, style: 'currency', currencySign: '$'}});
        columns.push({ id: 'percent', align: 'right', name: 'Actual %', field: 'percent', formatter: Formatters.Decimal, numberFormat: {minimumFractionDigits: 0, maximumFractionDigits: 0, style: 'percent'}});
        columns.push({ id: 'orderDate', name: 'Order Date', field: 'orderDate', formatter: Formatters.Date, dateFormat: 'M/d/yyyy'});
        columns.push({ id: 'phone', name: 'Phone', field: 'phone', formatter: Formatters.Text});

        columns.yk = columns;

        $('#datagrid').datagrid({
          columns: columns,
          dataset: res,
          saveColumns: false,
          toolbar: {title: 'Compressors', results: true, actions: true, rowHeight: true, personalize: true}
        });
      });
 });
</script>
tmcconechy commented 4 years ago

Have a fix but it requires a full regression test at minimum as is slightly risky. So will put it next version and not patch back to the previous release.

janahintal commented 4 years ago

Hi @tmcconechy, I noticed the following issues below upon smoke testing. Please see screenshots below. Thank you,

https://master-enterprise.demo.design.infor.com/components/applicationmenu/test-click-event-propagation?theme=uplift&variant=light windows 10 chrome image

windows 10 IE11 image

Windows 10 IE11 https://master-enterprise.demo.design.infor.com/components/popover/example-index?theme=uplift&variant=light image

tmcconechy commented 4 years ago

This seem unrelated but will push a few quick fixes as these are small.

janahintal commented 4 years ago

This issue is now resolved. Thank you. Will now move to Done.

tmcconechy commented 4 years ago

While testing this issue in SunSystems an additions downline error was found. I wasnt able to add a test but fixed the issue and tested it in the SunSystems showcase.

Reopening to put a PR on. cc @nbeare-info cc @rvaja-infor

jbrcna commented 4 years ago

QA Passed v4.29.0-dev https://master-enterprise.demo.design.infor.com/components/datagrid/test-save-settings-manual.html https://master-enterprise.demo.design.infor.com/components/datagrid/test-save-settings.html