formio/formio.js

Error while deleting a row from the data grid

radovan-jupa opened this issue · 1 comments

Describe the bug
If user tries to delete a row from datagrid (except the last one), then error occured and no row was deleted.

Version/Branch
5.0.0-rc.62

To Reproduce
Steps to reproduce the behavior:

  1. Create form with datagrid
    1. Add datagrid component
    2. Add text field to component
  2. Preview the form
  3. Add several rows to datagrid
  4. Remove any row (except the last one)
  5. Error: No row is removed and javascript error in console occurres

TypeError: Cannot read properties of undefined (reading 'getComponentPath')
at formio.full.min.js:2:1193098
at Array.forEach ()
at l.updateComponentsRowIndex (formio.full.min.js:2:1192871)
at formio.full.min.js:2:1193186
at Array.forEach ()
at l.updateRowsComponents (formio.full.min.js:2:1193164)
at l.removeRow (formio.full.min.js:2:1193439)

Expected behavior
If user tries to delete a row from datagrid, then the row is removed without any errors

Additional context
I think that problem is in file /src/components/datagrid/DataGrid.js at line 486 where Components are undefined. It seems like a problem with import - named import vs default import. Same import style is also used in DataMap.js

@radovan-jupa Thank you for reporting this issue. I can reproduce it and have logged a ticket for the backlog. We are always willing to review any contributions from the open-source community to resolve this issue.

For internal reference: FIO-8710