Skip to content

Commit

Permalink
Use deep equality check for plugin props (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
neeilya committed Apr 29, 2019
1 parent 62241f8 commit 93f71ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/plugin/src/ChartPlugin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';

import isEqual from 'lodash-es/isEqual';
import { createChart } from 'd2-charts-api';

import { apiFetchVisualization } from './api/visualization';
Expand Down Expand Up @@ -32,12 +32,12 @@ class ChartPlugin extends Component {
}

componentDidUpdate(prevProps) {
if (this.props.config !== prevProps.config) {
if (!isEqual(this.props.config, prevProps.config)) {
this.renderChart();
return;
}

if (this.props.filters !== prevProps.filters) {
if (!isEqual(this.props.filters, prevProps.filters)) {
this.renderChart();
return;
}
Expand Down

0 comments on commit 93f71ab

Please sign in to comment.