Skip to content
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
2 changes: 1 addition & 1 deletion public/r/data-grid.json

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions src/components/data-grid/data-grid-cell-variants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,10 @@ export function SelectCell<TData>({
const [value, setValue] = React.useState(initialValue);
const containerRef = React.useRef<HTMLDivElement>(null);
const cellOpts = cell.column.columnDef.meta?.cell;
const options = cellOpts?.variant === "select" ? cellOpts.options : [];
const options = React.useMemo(
() => (cellOpts?.variant === "select" ? cellOpts.options : []),
[cellOpts],
);
const optionByValue = React.useMemo(
() => new Map(options.map((option) => [option.value, option])),
[options],
Expand Down Expand Up @@ -1017,7 +1020,10 @@ export function MultiSelectCell<TData>({
const containerRef = React.useRef<HTMLDivElement>(null);
const inputRef = React.useRef<HTMLInputElement>(null);
const cellOpts = cell.column.columnDef.meta?.cell;
const options = cellOpts?.variant === "multi-select" ? cellOpts.options : [];
const options = React.useMemo(
() => (cellOpts?.variant === "multi-select" ? cellOpts.options : []),
[cellOpts],
);
const optionByValue = React.useMemo(
() => new Map(options.map((option) => [option.value, option])),
[options],
Expand Down
Loading