Skip to content

Commit c125e88

Browse files
committed
formatting
1 parent 568b34e commit c125e88

File tree

1 file changed

+8
-8
lines changed
  • packages/component-library/src/TableGrid

1 file changed

+8
-8
lines changed

packages/component-library/src/TableGrid/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)