Bug(tree map): 'Cannot read property 'filter' of undefined'
See original GitHub issueI’m submitting a … (check one with “x”)
[x] bug report
[ ] feature request
[ ] support request
Current behavior The tree map component will crash if given an empty data collection
Expected behavior The component shouldn’t crash. Instead, it shouldn’t render any information/elements
Reproduction of the problem https://plnkr.co/edit/K9aaZWwZWkqxXDWZFgOo?p=preview
What is the motivation / use case for changing the behavior? The other chart components have no problems to handle empty data collections. I would expect the same of the tree map component
- ngx-charts version:
- 4.x.x (local project)
- Latest version in the plnkr
- Angular version:
- 2.4.x (local project)
- Latest version in the plnkr
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'filter' of Undefined in JS
The "Cannot read property 'filter' of undefined" error occurs when calling the filter() method on a variable that stores an undefined value.
Read more >TypeError: Cannot read properties of undefined (reading 'map')
I had the same error and solved it by first asking if the array existed. Example: <Filter> { product.color?.map((c) => ( <FilterColor color ......
Read more >cannot read properties of undefined (reading 'filter') in react js
Because you are using state.users here, filter expect it to be an array. const ...
Read more >Uncaught TypeError: Cannot read property of null - iDiallo
Sometimes, your object is nested deeper like Tree.folder.path . You just have to make sure that if you need to access folder ,...
Read more >Uncaught TypeError: Cannot read property '1' of undefined
This error is because there is a property field in that model, on that form that doesn't have his generic value defined, probably...
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
We will fix this. In the meantime, you can also just hide the chart with *ngIf until the data is ready.
I’m having this problem. Has it been fixed in any version?