Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: name collision in isCellEditable breaks edit feature #3356

Merged
merged 2 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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