Skip to content

Commit

Permalink
add debounce for resize event
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Ding committed Jul 6, 2016
1 parent c1bb965 commit 272d137
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import ReactDOM from 'react-dom';
import $ from 'jquery';
import * as d3 from 'd3';
import _debounce from 'lodash/function/debounce';

export class StudentsDemographicsChart extends React.Component {
constructor(props, context) {
Expand Down Expand Up @@ -47,7 +48,7 @@ export class StudentsDemographicsChart extends React.Component {
this.barsDOM = d3.select(ReactDOM.findDOMNode(this.refs.barsDOM));

this.renderChart();
$(window).on('resize.demographics_chart', this.onResize);
$(window).on('resize.demographics_chart', _debounce(this.onResize, 200));
}

componentDidUpdate() {
Expand Down

0 comments on commit 272d137

Please sign in to comment.