esnet / esnet/react-timeseries-charts
Can't pass null to Charts children
- Dominant language
- JavaScript
- Stars
- 876
- Forks
- 279
- PR merge metrics
- No merged PRs in 30d
Description
# 🐛Bug report
**Describe the bug**
I want to do this:
```jsx
{!hasDuplicateTimestamps && (
)}
```
I might have multiple events at a given timestamp. If I do, I don't want to render a line.
Most places where `children` are looped over, `null`s are checked:
https://github.com/esnet/react-timeseries-charts/blob/aa9c9b368100d78337b562d9e2833f2d90d9de3d/src/components/ChartRow.js#L312-L313
but there's no check here:
https://github.com/esnet/react-timeseries-charts/blob/aa9c9b368100d78337b562d9e2833f2d90d9de3d/src/components/ChartRow.js#L316-L317
resulting in this stack trace:
```
Uncaught (in promise) TypeError: Cannot read property 'props' of null
at ChartRow.js:377
at forEachSingleChild (react.development.js:1118)
at traverseAllChildrenImpl (react.development.js:1007)
...
```
**To Reproduce**
Steps to reproduce the behavior:
1. Pass a `null` into the `children` for a `` instance
2. View crash
**Expected behavior**
`null`s are handle. I believe it's just a matter of adding `if (chart === null) return;` to line 317 of ChartRow.js
---
want me to send a PR?
Contributor guide
Assessment
This issue has not been assessed yet.