Skip to content

Commit

Permalink
fix: Prevent Table from crashing when removing a column in edit state (
Browse files Browse the repository at this point in the history
  • Loading branch information
abdhalees authored Jan 28, 2025
1 parent 34cd820 commit 7f23985
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/table/__tests__/body-cell.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ describe('TableBodyCell', () => {
expect(stickyCellRef).toHaveBeenCalledWith(null);
});

it('should not throw an error if column is not editable', () => {
const col: typeof column = {
id: 'test',
header: 'Test',
cell: item => item.test,
};
render(<TestComponent column={col} isEditing={true} />);
});

describe('success icon behaviour', () => {
const bodyCellSuccessIcon$ = `.${styles['body-cell-success']}`;

Expand Down
2 changes: 1 addition & 1 deletion src/table/body-cell/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function TableCellEditable<ItemType>({
onMouseEnter={() => setHasHover(true)}
onMouseLeave={() => setHasHover(false)}
>
{isEditing ? (
{isEditing && column.editConfig ? (
<InlineEditor
ariaLabels={ariaLabels}
column={column}
Expand Down

0 comments on commit 7f23985

Please sign in to comment.