Skip to content

Commit

Permalink
bug: Renaming isCellEditable utility function as it clashes with isCe…
Browse files Browse the repository at this point in the history
…llEditable from DataGrid under certain conditions, breaking edit feature
  • Loading branch information
PenguinOfWar committed Oct 5, 2023
1 parent 24a3de8 commit 268e3d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { memo } from 'react';
import { css } from '@linaria/core';

import { useRovingTabIndex } from './hooks';
import { createCellEvent, getCellClassname, getCellStyle, isCellEditable } from './utils';
import { createCellEvent, getCellClassname, getCellStyle, isCellEditableUtil } from './utils';
import type { CellRendererProps } from './types';

const cellCopied = css`
Expand Down Expand Up @@ -51,7 +51,7 @@ function Cell<R, SR>({
},
typeof cellClass === 'function' ? cellClass(row) : cellClass
);
const isEditable = isCellEditable(column, row);
const isEditable = isCellEditableUtil(column, row);

function selectCellWrapper(openEditor?: boolean) {
selectCell({ rowIdx, idx: column.idx }, openEditor);
Expand Down
4 changes: 2 additions & 2 deletions src/utils/selectedCellUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ export function isSelectedCellEditable<R, SR>({
}: IsSelectedCellEditableOpts<R, SR>): boolean {
const column = columns[selectedPosition.idx];
const row = rows[selectedPosition.rowIdx];
return isCellEditable(column, row);
return isCellEditableUtil(column, row);
}

export function isCellEditable<R, SR>(column: CalculatedColumn<R, SR>, row: R): boolean {
export function isCellEditableUtil<R, SR>(column: CalculatedColumn<R, SR>, row: R): boolean {
return (
column.renderEditCell != null &&
(typeof column.editable === 'function' ? column.editable(row) : column.editable) !== false
Expand Down

0 comments on commit 268e3d2

Please sign in to comment.