Skip to content

Commit

Permalink
Prevent editing error where selection can end up temporarily set to o…
Browse files Browse the repository at this point in the history
…ut of bounds locations
  • Loading branch information
jassmith committed Apr 10, 2022
1 parent 9f13f2e commit 0e62b1c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/data-editor/data-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1695,15 +1695,15 @@ const DataEditorImpl: React.ForwardRefRenderFunction<DataEditorRef, DataEditorPr
const isEditingTrailingRow =
gridSelection.current.cell[1] === mangledRows - 1 && newValue !== undefined;
updateSelectedCell(
gridSelection.current.cell[0] + movX,
gridSelection.current.cell[1] + movY,
clamp(gridSelection.current.cell[0] + movX, 0, mangledCols.length - 1),
clamp(gridSelection.current.cell[1] + movY, 0, mangledRows - 1),
isEditingTrailingRow,
false
);
}
onFinishedEditing?.(newValue, movement);
},
[overlay?.cell, focus, gridSelection, onFinishedEditing, mangledOnCellEdited, mangledRows, updateSelectedCell]
[overlay?.cell, focus, gridSelection, onFinishedEditing, mangledOnCellEdited, mangledRows, updateSelectedCell, mangledCols.length]
);

const overlayID = React.useMemo(() => {
Expand Down

0 comments on commit 0e62b1c

Please sign in to comment.