Open ColinMorris83 opened 3 months ago
Just to update, issue still exists with latest 3.0.1 version. And after a bit more experimenting, it might be related to the showing of skeleton in the loading state. If the state uses showLoadingOverlay there is no error:
state: { showLoadingOverlay: isFetching },
Whilst both of these will cause the error:
state: { isLoading: isFetching },
state: { showSkeletons: isFetching },
material-react-table version
v2.13.1
react & react-dom versions
v18.3.1
Describe the bug and the steps to reproduce it
After going from v2.11.3 to any newer version, am getting an error during rendering of any table that has an accessorFn that uses nested props. e.g.
accessorFn: (row) => `${row.IdentityInfo.LastName}, ${row.IdentityInfo.FirstName}`,
Will error in the console about trying to call LastName on undefined.
Have narrowed it down in the sandbox to the use of enableFacetedValues and setting the isLoading property on the state, and having the table data set into the state inside a useEffect. This combination seems to cause the error. Taking away any of these stops the error. i.e remove the enableFacetedValues prop, or remove the isLoading prop from state, or have the items initially populated when component loads rather than after a useEffect has run.
Also worth noting it's not just accessorFn with an issue, even using a nested accessorKey like 'name.lastname' also causes errors in the console, although the table does at least still render in this case.
Minimal, Reproducible Example - (Optional, but Recommended)
https://codesandbox.io/p/devbox/boring-wilson-q77l7n
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
No, because I do not know how
Terms