TypeError: Cannot read properties of undefined (reading 'id')
See original GitHub issueHi,
unfortunately I cannot reproduce reliably, but it seems that with the introduction of #619 the following exception occurs:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'id')
at material-table.js:1273:1
at Array.map (<anonymous>)
at reduceByDefaultSort (material-table.js:1271:1)
at getDefaultCollectionSort (material-table.js:1261:1)
at MaterialTable.setDataManagerFields (material-table.js:776:1)
at MaterialTable.componentDidUpdate (material-table.js:835:1)
at commitLifeCycles (react-dom.development.js:20684:1)
at commitLayoutEffects (react-dom.development.js:23426:1)
at HTMLUnknownElement.callCallback (react-dom.development.js:3945:1)
at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:1)
It occurs when switching views in my application, so I assume when loading/unloading tables. Reason seems to be that sometimes the list of sort columns does not contain objects with a “tableData” object attached:
- OS: Win11
- Browser: Edge, Firefox
Any ideas?
Issue Analytics
- State:
- Created 9 months ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
TypeError: Cannot read properties of undefined (reading 'id')
I have this error in my terminal: TypeError: Cannot read properties of undefined (reading 'id').
Read more >Cannot read properties of undefined (reading 'id') - TrackJS
TypeError is a subset of JavaScript Error that is thrown when code attempts to do something that does not exist on the target...
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
The TypeError: Cannot read property of undefined is one of the most common type errors in JavaScript. It occurs when a property is...
Read more >cannot read properties of undefined (reading 'id') angular
The following exception is thrown: "ERROR TypeError: Cannot read properties of undefined (reading 'ID')". Expected result. The method should return the index of ......
Read more >sfdx force:auth:web:login results in Cannot read properties of ...
"Cannot read properties of undefined (reading 'id'). This is most likely not an error with the Salesforce CLI. Please ensure all information ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It can be reproduced in this page : https://codesandbox.io/s/new-tree-znzku?file=/src/App.js
And I think the reproduction’s conditions are
I made a pull request for fix this case, but there may be a better solution.
I know that in my app the problem gets fixed if I remove the
defaultSort
attribute from the column but as mentioned before I was unable to reproduce that in a sandbox. This is an example table definition that causes issues: