@@ -3,6 +3,7 @@ import {Skeleton} from '@gravity-ui/uikit';
33import { DEFAULT_ALIGN , DEFAULT_RESIZEABLE } from './constants' ;
44import { b } from './shared' ;
55import type { AlignType , Column , GetRowClassName } from './types' ;
6+ import { typedMemo } from './utils' ;
67
78interface TableCellProps {
89 height : number ;
@@ -38,19 +39,18 @@ const TableRowCell = ({
3839
3940interface LoadingTableRowProps < T > {
4041 columns : Column < T > [ ] ;
41- index : number ;
4242 height : number ;
4343}
4444
45- export const LoadingTableRow = < T , > ( { index , columns, height} : LoadingTableRowProps < T > ) => {
45+ export const LoadingTableRow = typedMemo ( function < T > ( { columns, height} : LoadingTableRowProps < T > ) {
4646 return (
4747 < tr className = { b ( 'row' , { loading : true } ) } >
4848 { columns . map ( ( column ) => {
4949 const resizeable = column . resizeable ?? DEFAULT_RESIZEABLE ;
5050
5151 return (
5252 < TableRowCell
53- key = { ` ${ column . name } ${ index } ` }
53+ key = { column . name }
5454 height = { height }
5555 width = { column . width }
5656 align = { column . align }
@@ -66,17 +66,16 @@ export const LoadingTableRow = <T,>({index, columns, height}: LoadingTableRowPro
6666 } ) }
6767 </ tr >
6868 ) ;
69- } ;
69+ } ) ;
7070
7171interface TableRowProps < T > {
7272 columns : Column < T > [ ] ;
73- index : number ;
7473 row : T ;
7574 height : number ;
7675 getRowClassName ?: GetRowClassName < T > ;
7776}
7877
79- export const TableRow = < T , > ( { row, index , columns, getRowClassName, height} : TableRowProps < T > ) => {
78+ export const TableRow = < T , > ( { row, columns, getRowClassName, height} : TableRowProps < T > ) => {
8079 const additionalClassName = getRowClassName ?.( row ) ;
8180
8281 return (
@@ -86,14 +85,14 @@ export const TableRow = <T,>({row, index, columns, getRowClassName, height}: Tab
8685
8786 return (
8887 < TableRowCell
89- key = { ` ${ column . name } ${ index } ` }
88+ key = { column . name }
9089 height = { height }
9190 width = { column . width }
9291 align = { column . align }
9392 className = { column . className }
9493 resizeable = { resizeable }
9594 >
96- { column . render ( { row, index } ) }
95+ { column . render ( { row} ) }
9796 </ TableRowCell >
9897 ) ;
9998 } ) }
0 commit comments