@dooherceg/material-react-table 3.2.19 → 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.js CHANGED
@@ -2707,11 +2707,8 @@ const handleUpdateRow = ({ getRowId, setRowsState, }) => {
2707
2707
  if (!rowsToUpdate.length)
2708
2708
  return previousRows;
2709
2709
  const rowById = new Map();
2710
- rowsToUpdate.forEach((row, index) => {
2711
- const rowId = getResolvedRowId(row, index, undefined, getRowId);
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);
@@ -2741,14 +2738,13 @@ const handleUpsertRow = ({ getRowId, pageSize, setRowsState, }) => {
2741
2738
  }
2742
2739
  });
2743
2740
  const rowsToInsert = [];
2744
- rowsToUpsert.forEach((row, index) => {
2745
- const rowId = getResolvedRowId(row, index, undefined, getRowId);
2746
- const existingIndex = rowId !== undefined ? indexByRowId.get(rowId) : undefined;
2741
+ rowsToUpsert.forEach((row) => {
2742
+ const existingIndex = indexByRowId.get(row.id);
2747
2743
  if (existingIndex === undefined) {
2748
2744
  rowsToInsert.push(row);
2749
2745
  return;
2750
2746
  }
2751
- nextRows[existingIndex] = row;
2747
+ nextRows[existingIndex] = Object.assign(Object.assign({}, nextRows[existingIndex]), row);
2752
2748
  });
2753
2749
  return capRowsToPageSize([...rowsToInsert, ...nextRows], pageSize);
2754
2750
  });