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:
Robert Elliott 2018-11-27 11:39:40 +02:00 committed by GitHub
commit 0a134d2d53
1 changed files with 2 additions and 2 deletions

View File

@ -3,7 +3,7 @@
/**
* External dependencies
*/
import { isEqual } from 'lodash';
import { isEmpty, isEqual } from 'lodash';
import { Component, createRef } from '@wordpress/element';
import PropTypes from 'prop-types';
import classNames from 'classnames';
@ -162,7 +162,7 @@ class D3Chart extends Component {
}
render() {
if ( ! this.props.data ) {
if ( isEmpty( this.props.data ) ) {
return null; // TODO: improve messaging
}
return (