LightningFlowComponents icon indicating copy to clipboard operation
LightningFlowComponents copied to clipboard

DataTable - In line Edit - Dates set to null if other columns edited afterwards - Invalid Date {} inserted into editedRows

Open kurtfairfield opened this issue 2 years ago • 1 comments

Steps to reproduce

Steps to reproduce the behavior:

  1. Go to a datatable with date fields, Save button is not hidden
  2. Click and edit a Date column, press Save
  3. Click and edit another column, press Save

Expected behaviour

When multiple saves made to the table, the values displayed in the datatable for Date fields are passed out in the Edited Rows variable of the component.

Actual behaviour

When multiple saves are made to the table, even though valid dates are shown in the datatable, post save, these values are set to null if another edit to another field is made and saved. If the last field you edited and saved was a Date field, that value is kept, but other date values edited earlier are null

Screenshots

This is the screen flow showing the values going that are being set in the table, with the logs appended shown to highlight the console.log outputs that highlight the error.

image

I added a console.log statement in the handleSave method around lines 1400-1500 of datatable.js to see the three unique saves to data in order (Start Date, End Date, and then finally Tags), as well as output the values for mydata and editedRows.

You can see that when the value gets updated in the arrays properly for the first edit to Start Date, but the second edit for End Date, somehow the Start Date now becomes an Invalid Date {}.

I notice that some times the date is a string - Start_Date__c: "2003-07-01" and then later it is a Date type - Start_Date__c: Tue Jul 01 2003 10:00:00 GMT-0600 (Mexican Pacific Daylight Time) {}. Perhaps there is a data type mismatch that may be relevant to issue?

Debug Logs

Console log from DataTable nulling Date fields with Edited Rows inspection - apex-07L0r000009uVd2EAE.log

kurtfairfield avatar Jul 27 '22 00:07 kurtfairfield

This has been resolved in v4.0.9

ericrsmith35 avatar Sep 11 '22 16:09 ericrsmith35