Merge pull request woocommerce/woocommerce-admin#910 from woocommerce/fix/chart-empty-data
Bug: noticed a new NaN error caused by attempt to draw chart with empty data
This commit is contained in:
commit
0a134d2d53
|
@ -3,7 +3,7 @@
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
import { isEqual } from 'lodash';
|
import { isEmpty, isEqual } from 'lodash';
|
||||||
import { Component, createRef } from '@wordpress/element';
|
import { Component, createRef } from '@wordpress/element';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
@ -162,7 +162,7 @@ class D3Chart extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if ( ! this.props.data ) {
|
if ( isEmpty( this.props.data ) ) {
|
||||||
return null; // TODO: improve messaging
|
return null; // TODO: improve messaging
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue