Skip to content

Commit 2daa0f7

Browse files
committed
cell keys include staticRowIndex
1 parent 0c7612d commit 2daa0f7

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

packages/material-react-table/src/components/body/MRT_TableBodyCell.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
313313
) : isCreating || isEditing ? (
314314
<MRT_EditCellTextField
315315
cell={cell}
316-
staticRowIndex={staticRowIndex}
317316
table={table}
318317
/>
319318
) : showClickToCopyButton && columnDef.enableClickToCopy !== false ? (

packages/material-react-table/src/components/body/MRT_TableBodyRow.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,16 +248,17 @@ export const MRT_TableBodyRow = <TData extends MRT_RowData>({
248248
staticRowIndex,
249249
table,
250250
};
251+
const key = `${cell.id}-${staticRowIndex}`;
251252
return cell ? (
252253
memoMode === 'cells' &&
253254
cell.column.columnDef.columnDefType === 'data' &&
254255
!draggingColumn &&
255256
!draggingRow &&
256257
editingCell?.id !== cell.id &&
257258
editingRow?.id !== row.id ? (
258-
<Memo_MRT_TableBodyCell key={cell.id} {...props} />
259+
<Memo_MRT_TableBodyCell key={key} {...props} />
259260
) : (
260-
<MRT_TableBodyCell key={cell.id} {...props} />
261+
<MRT_TableBodyCell key={key} {...props} />
261262
)
262263
) : null;
263264
},

packages/material-react-table/src/components/inputs/MRT_EditCellTextField.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@ import { getValueAndLabel, parseFromValuesOrFunc } from '../../utils/utils';
1717
export interface MRT_EditCellTextFieldProps<TData extends MRT_RowData>
1818
extends TextFieldProps<'standard'> {
1919
cell: MRT_Cell<TData>;
20-
staticRowIndex?: number;
2120
table: MRT_TableInstance<TData>;
2221
}
2322

2423
export const MRT_EditCellTextField = <TData extends MRT_RowData>({
2524
cell,
26-
staticRowIndex,
2725
table,
2826
...rest
2927
}: MRT_EditCellTextFieldProps<TData>) => {
@@ -109,7 +107,6 @@ export const MRT_EditCellTextField = <TData extends MRT_RowData>({
109107
return (
110108
<TextField
111109
disabled={parseFromValuesOrFunc(columnDef.enableEditing, row) === false}
112-
key={`${row.id}-${row.index}-${staticRowIndex}`}
113110
fullWidth
114111
inputRef={(inputRef) => {
115112
if (inputRef) {

0 commit comments

Comments
 (0)