material-react-table version
v3.2.1
react & react-dom versions
v19.2.0
Describe the bug and the steps to reproduce it
This issue is just typescript bug, but i hope MRT has better typescript for safety type.
When insert data: [] and state: { isLoading: true } and getRowId: (data) => data.id.toString() as useMeterialReactTable props, getRowId function raise exception (Cannot read properties of null (reading 'toString')).
=> i believe natuaral situation with empty data and loading.
useMaterialReactTable's getRowId function prop requires always TData extends MRT_RowData.
On runtime with above conditions, row data can be null-optional object by this logic for loading skeleton UI.
Minimal, Reproducible Example - (Optional, but Recommended)
https://stackblitz.com/edit/github-fofcgbmf?file=src%2FTS.tsx
Screenshots or Videos (Optional)
getRowId argument type allows to use TData type itself
Do you intend to try to help solve this bug with your own PR?
Yes, I think I know how to fix it and will discuss it in the comments of this issue
Terms
material-react-table version
v3.2.1
react & react-dom versions
v19.2.0
Describe the bug and the steps to reproduce it
This issue is just typescript bug, but i hope MRT has better typescript for safety type.
When insert
data: []andstate: { isLoading: true }andgetRowId: (data) => data.id.toString()asuseMeterialReactTableprops,getRowIdfunction raise exception (Cannot read properties of null (reading 'toString')).=> i believe natuaral situation with empty data and loading.
useMaterialReactTable'sgetRowIdfunction prop requires alwaysTData extends MRT_RowData.On runtime with above conditions,
rowdata can be null-optional object by this logic for loading skeleton UI.Minimal, Reproducible Example - (Optional, but Recommended)
https://stackblitz.com/edit/github-fofcgbmf?file=src%2FTS.tsx
Screenshots or Videos (Optional)
getRowIdargument type allows to useTDatatype itselfDo you intend to try to help solve this bug with your own PR?
Yes, I think I know how to fix it and will discuss it in the comments of this issue
Terms