delimiter icon indicating copy to clipboard operation
delimiter copied to clipboard

Improve diff method

Open timwis opened this issue 6 years ago • 0 comments

At the moment, when a CSV file is fetched, it is parsed and then stored in state, which is passed down to the spreadsheet editor component. Editing it applies the changes to the data in state, as expected. But in order to generate the diff, we need to pass daff the original version of the data as well as the current version. So we have to store the data in state twice. And a deep clone of it at that, since we don't want the original version to be affected by changes to the "working version."

It's not that big of a deal but for large spreadsheets, we'd be storing them in memory twice. I wonder if there's a more efficient way to compute the diff, particularly considering the application is aware of every individual change made to the data. We could just store the changes, and then compute them when generating the diff (we'd want to ignore obsolete changes for example), though it gets a bit complicated when the change is something like sorting the whole dataset.

timwis avatar Feb 14 '19 13:02 timwis