@dooherceg/material-react-table 3.2.18 → 3.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +6 -2
- package/dist/index.esm.js +7 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2707,17 +2707,13 @@ const handleUpdateRow = ({ getRowId, setRowsState, }) => {
|
|
|
2707
2707
|
if (!rowsToUpdate.length)
|
|
2708
2708
|
return previousRows;
|
|
2709
2709
|
const rowById = new Map();
|
|
2710
|
-
rowsToUpdate.forEach((row
|
|
2711
|
-
|
|
2712
|
-
if (rowId !== undefined) {
|
|
2713
|
-
rowById.set(rowId, row);
|
|
2714
|
-
}
|
|
2710
|
+
rowsToUpdate.forEach((row) => {
|
|
2711
|
+
rowById.set(row.id, row);
|
|
2715
2712
|
});
|
|
2716
2713
|
return previousRows.map((row, index) => {
|
|
2717
2714
|
const rowId = getResolvedRowId(row, index, undefined, getRowId);
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
: row;
|
|
2715
|
+
const updatedRow = rowId !== undefined ? rowById.get(rowId) : undefined;
|
|
2716
|
+
return updatedRow !== undefined ? Object.assign(Object.assign({}, row), updatedRow) : row;
|
|
2721
2717
|
});
|
|
2722
2718
|
});
|
|
2723
2719
|
};
|
|
@@ -2742,14 +2738,13 @@ const handleUpsertRow = ({ getRowId, pageSize, setRowsState, }) => {
|
|
|
2742
2738
|
}
|
|
2743
2739
|
});
|
|
2744
2740
|
const rowsToInsert = [];
|
|
2745
|
-
rowsToUpsert.forEach((row
|
|
2746
|
-
const
|
|
2747
|
-
const existingIndex = rowId !== undefined ? indexByRowId.get(rowId) : undefined;
|
|
2741
|
+
rowsToUpsert.forEach((row) => {
|
|
2742
|
+
const existingIndex = indexByRowId.get(row.id);
|
|
2748
2743
|
if (existingIndex === undefined) {
|
|
2749
2744
|
rowsToInsert.push(row);
|
|
2750
2745
|
return;
|
|
2751
2746
|
}
|
|
2752
|
-
nextRows[existingIndex] = row;
|
|
2747
|
+
nextRows[existingIndex] = Object.assign(Object.assign({}, nextRows[existingIndex]), row);
|
|
2753
2748
|
});
|
|
2754
2749
|
return capRowsToPageSize([...rowsToInsert, ...nextRows], pageSize);
|
|
2755
2750
|
});
|