@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.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, 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);
2718
- return rowId !== undefined && rowById.has(rowId)
2719
- ? rowById.get(rowId)
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, index) => {
2746
- const rowId = getResolvedRowId(row, index, undefined, getRowId);
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
  });