Skip to content

Commit

Permalink
Next.js bug: name collision in isCellEditable breaks edit feature (ad…
Browse files Browse the repository at this point in the history
…azzle#3356)

Co-authored-by: Nicolas Stepien <567105+nstepien@users.noreply.github.com>
  • Loading branch information
2 people authored and adityatoshniwal committed Jul 31, 2024
1 parent 78af7c6 commit 23e3dae
Show file tree
Hide file tree
Showing 2 changed files with 5 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
5 changes: 3 additions & 2 deletions src/utils/selectedCellUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ 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 {
// https://github.com/vercel/next.js/issues/56480
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 23e3dae

Please sign in to comment.