(core) Change array.reverse() in GranularAccess to avoid accidental in-place reversal.

Test Plan: Added a test case to tickle the bug this was causing.

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D2718
This commit is contained in:
Dmitry S 2021-01-28 15:07:27 -05:00
parent ec023a3ba6
commit 7c81cf2368

View File

@ -642,8 +642,8 @@ export class GranularAccess {
// TODO: this would need to be elaborated to work well on bundles containing table // TODO: this would need to be elaborated to work well on bundles containing table
// renames. // renames.
const tableId = getTableId(rowsBefore); const tableId = getTableId(rowsBefore);
for (const snapshots of allRowSnapshots.reverse()) { for (let i = allRowSnapshots.length - 1; i >= 0; i--) {
const rowsAfter = snapshots[1]; const rowsAfter = allRowSnapshots[i][1];
if (getTableId(rowsAfter) === tableId) { if (getTableId(rowsAfter) === tableId) {
return {rowsBefore, rowsAfter}; return {rowsBefore, rowsAfter};
} }