@@ -59,7 +59,7 @@ export const TableGrid = <TData extends Record<string, unknown>>({
5959 return colDefs . map ( ( colDef ) => {
6060 return {
6161 ...colDef ,
62- // the types in ag-grid are `any` for the cellRenderers
62+ // the types in ag-grid are `any` for the cellRenderers which is throwing an error here
6363 // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
6464 cellRenderer : isLoading
6565 ? ( colDef . loadingCellRenderer ?? SkeletonCellRenderer )
@@ -69,21 +69,21 @@ export const TableGrid = <TData extends Record<string, unknown>>({
6969 } , [ colDefs , isLoading ] ) ;
7070
7171 const onPaginationChanged = useCallback ( ( ) => {
72- if ( gridRef . current ?. api ) {
73- const api = gridRef . current . api ;
74- setPageSize ( api . paginationGetPageSize ( ) ) ;
75- setCurrentPage ( api . paginationGetCurrentPage ( ) + 1 ) ;
76- setTotalPages ( api . paginationGetTotalPages ( ) ) ;
77- }
72+ const api = gridRef . current ?. api ;
73+ if ( ! api ) return ;
74+ setPageSize ( api . paginationGetPageSize ( ) ) ;
75+ setCurrentPage ( api . paginationGetCurrentPage ( ) + 1 ) ;
76+ setTotalPages ( api . paginationGetTotalPages ( ) ) ;
7877 } , [ ] ) ;
78+
7979 const onPageChange = useCallback ( ( newPage : number ) => {
8080 gridRef . current ?. api . paginationGoToPage ( newPage - 1 ) ;
8181 } , [ ] ) ;
8282
8383 const tableGrid = (
8484 < AgGridReact < TData >
8585 className = { styles . tableGrid }
86- // @ts -expect-error empty row data
86+ // @ts -expect-error empty row data, which is throwing an error here btu required to display 1 row in the loading state
8787 rowData = { isLoading ? [ [ ] ] : rowData }
8888 defaultColDef = { defaultColDef }
8989 columnDefs = { mappedColDefs }
0 commit comments