Fix typescript errors tableview

This commit is contained in:
arttu
2024-05-29 21:41:54 +03:00
parent e1a62f5445
commit 0d344a4778
2 changed files with 3 additions and 3 deletions
@@ -14,13 +14,13 @@ export const ActionComponent = <T extends MRT_RowData>({
selectorFn,
}: {
row: MRT_Row<T>
idFieldName: keyof T
idFieldName?: keyof T
checkRowRestriction: ((row: T) => boolean) | undefined
url: string | undefined
selectorFn?: (id: T) => void
}) => {
const navigate = useNavigate()
const id = row.original[idFieldName]
const id = row.original[idFieldName!]
const getIconToShow = () => {
if (selectorFn) return <AddCircleOutlineIcon />
return <ManageSearchIcon />
@@ -107,7 +107,7 @@ export const TableView = <T extends MRT_RowData>({
if (selectorFn) {
return
}
setIdList(table.getPrePaginationRowModel().rows.map(row => row.original[idFieldName] as string))
setIdList(table.getPrePaginationRowModel().rows.map(row => row.original[idFieldName!] as string))
// Don't put setIdList in the dependency array: it will cause re-render loop.
// eslint-disable-next-line react-hooks/exhaustive-deps