(core) simplify document comparison code, and flesh out diff with local changes

Summary:
With recent changes to action history, we can now remove the temporary
`finalRowContent` field from change details, since all the information
we need is now in the ActionSummary.

We also now have more information about the state of the common ancestor,
which previously we could not get either from ActionSummary or from
`finalRowContent`. We take advantage of that to flesh out rendering
differences where there are some changes locally and some changes
remotely.

There's still a lot more to do, this is just one step.

I have added a link to the UI for viewing the comparison. I wouldn't
want to advertise that link until diffs are robust to name changes.

Test Plan: added test, updated tests

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2658
This commit is contained in:
Paul Fitzpatrick
2020-11-11 15:25:37 -05:00
parent 2a592d8b4d
commit c67966775b
8 changed files with 100 additions and 123 deletions

View File

@@ -1,6 +1,5 @@
import {CellDelta, TabularDiff, TabularDiffs} from 'app/common/TabularDiff';
import toPairs = require('lodash/toPairs');
import { RowRecord } from 'app/plugin/GristData';
/**
* An ActionSummary represents the overall effect of changes that took place
@@ -91,13 +90,6 @@ export interface TableDelta {
/** Partial record of cell-level changes - large bulk changes not included. */
columnDeltas: {[colId: string]: ColumnDelta};
columnRenames: LabelDelta[]; /** a list of column renames/additions/removals */
/*
* A snapshot of row content for added and updated rows, including formula columns.
* Not included in regular summaries, but used in comparisons. Hopefully this
* can evaporate in future.
*/
finalRowContent?: {[rowId: number]: RowRecord};
}
/**