Skip to content

Commit bc4c426

Browse files
paulfitzclaude
andcommitted
Show locally-added rows in the comparison changed-rows view
The "changed rows only" filter (TableDataWithDiff.getKeepFunc) kept updated rows, removed rows, and synthetic rows, but not locally-added rows. A locally-added row is a real row in the core table, present only in the delta's addRows, so it was filtered out and never shown as a local-add. It rendered before only when an added row also happened to appear in updateRows, which made the existing comparison test flaky. Keep leftTableDelta.addRows in the filter, alongside updates and removals. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent a16a428 commit bc4c426

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

app/client/models/DataTableModelWithDiff.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ export class TableDataWithDiff {
250250
private _leftRemovals: Set<number>;
251251
private _rightRemovals: Set<number>;
252252
private _updates: Set<number>;
253+
// Rows added locally: real positive ids in the core table, kept in the "changed rows only"
254+
// view alongside updates and removals. (Remote adds use synthetic negative ids; see rowId < 0.)
255+
private _localAdds: Set<number>;
253256
// Stores pre-deletion column values for each removed row, keyed by rowId.
254257
// Used to distinguish undo (values match) from ID recycling (values differ).
255258
private _removedRowValues = new Map<number, Record<string, CellDelta[0]>>();
@@ -268,6 +271,7 @@ export class TableDataWithDiff {
268271
...leftTableDelta.updateRows.filter(r => !this._rightRemovals.has(r)),
269272
...rightTableDelta.updateRows.filter(r => !this._leftRemovals.has(r)),
270273
]);
274+
this._localAdds = new Set(leftTableDelta.addRows);
271275
}
272276

273277
public getColIds(): string[] {
@@ -309,6 +313,7 @@ export class TableDataWithDiff {
309313
if (this._options?.showAllRows) { return undefined; }
310314
return (rowId: number | "new") => {
311315
return rowId === "new" || this._updates.has(rowId) || rowId < 0 ||
316+
this._localAdds.has(rowId) ||
312317
this._leftRemovals.has(rowId) || this._rightRemovals.has(rowId);
313318
};
314319
}

0 commit comments

Comments
 (0)