From 268e3d2244160afbc32c5010deb0bf89e90a963e Mon Sep 17 00:00:00 2001 From: Darryl Walker Date: Thu, 5 Oct 2023 13:35:47 +0100 Subject: [PATCH 1/2] bug: Renaming isCellEditable utility function as it clashes with isCellEditable from DataGrid under certain conditions, breaking edit feature --- src/Cell.tsx | 4 ++-- src/utils/selectedCellUtils.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Cell.tsx b/src/Cell.tsx index d0a26f28bd..cb04228a69 100644 --- a/src/Cell.tsx +++ b/src/Cell.tsx @@ -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` @@ -51,7 +51,7 @@ function Cell({ }, 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); diff --git a/src/utils/selectedCellUtils.ts b/src/utils/selectedCellUtils.ts index 956aabcef2..d22a039ca1 100644 --- a/src/utils/selectedCellUtils.ts +++ b/src/utils/selectedCellUtils.ts @@ -20,10 +20,10 @@ export function isSelectedCellEditable({ }: IsSelectedCellEditableOpts): boolean { const column = columns[selectedPosition.idx]; const row = rows[selectedPosition.rowIdx]; - return isCellEditable(column, row); + return isCellEditableUtil(column, row); } -export function isCellEditable(column: CalculatedColumn, row: R): boolean { +export function isCellEditableUtil(column: CalculatedColumn, row: R): boolean { return ( column.renderEditCell != null && (typeof column.editable === 'function' ? column.editable(row) : column.editable) !== false From 4b38bc7c061ebcfa54016cd6e2d6b428e61ce101 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien <567105+nstepien@users.noreply.github.com> Date: Thu, 5 Oct 2023 21:26:43 +0100 Subject: [PATCH 2/2] add comment --- src/utils/selectedCellUtils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/selectedCellUtils.ts b/src/utils/selectedCellUtils.ts index d22a039ca1..a3142da8ce 100644 --- a/src/utils/selectedCellUtils.ts +++ b/src/utils/selectedCellUtils.ts @@ -23,6 +23,7 @@ export function isSelectedCellEditable({ return isCellEditableUtil(column, row); } +// https://github.com/vercel/next.js/issues/56480 export function isCellEditableUtil(column: CalculatedColumn, row: R): boolean { return ( column.renderEditCell != null &&