<commit_before>var React = require('react');

module.exports = function (chartType, Highcharts){
  var displayName = 'Highcharts' + chartType;
  var result = React.createClass({
    displayName: displayName,

    propTypes: {
      config: React.PropTypes.object.isRequired,
      isPureConfig: React.PropTypes.bool
    },

    renderChart: function (config){
      if (!config) {
        throw new Error('Config must be specified for the ' + displayName + ' component');
      }
      let chartConfig = config.chart;
      this.chart = new Highcharts[chartType]({
        ...config,
        chart: {
          ...chartConfig,
          renderTo: this.refs.chart
        }
      });

      requestAnimationFrame(()=>{
        this.chart.reflow()
      })
    },

    shouldComponentUpdate(nextProps) {
      if (!this.props.isPureConfig || !(this.props.config === nextProps.config)) {
        this.renderChart(nextProps.config);
      }
      return true;
    },

    getChart: function (){
      if (!this.chart) {
        throw new Error('getChart() should not be called before the component is mounted');
      }
      return this.chart;
    },

    componentDidMount: function (){
      this.renderChart(this.props.config);
    },

    render: function (){
      let props = this.props;
      props = {
        ...props,
        ref: 'chart'
      };<commit_msg>Only reflow in the browser<commit_after>var React = require('react');

module.exports = function (chartType, Highcharts){
  var displayName = 'Highcharts' + chartType;
  var result = React.createClass({
    displayName: displayName,

    propTypes: {
      config: React.PropTypes.object.isRequired,
      isPureConfig: React.PropTypes.bool
    },

    renderChart: function (config){
      if (!config) {
        throw new Error('Config must be specified for the ' + displayName + ' component');
      }
      let chartConfig = config.chart;
      this.chart = new Highcharts[chartType]({
        ...config,
        chart: {
          ...chartConfig,
          renderTo: this.refs.chart
        }
      });

      global.requestAnimationFrame && requestAnimationFrame(()=>{
        this.chart.reflow()
      })
    },

    shouldComponentUpdate(nextProps) {
      if (!this.props.isPureConfig || !(this.props.config === nextProps.config)) {
        this.renderChart(nextProps.config);
      }
      return true;
    },

    getChart: function (){
      if (!this.chart) {
        throw new Error('getChart() should not be called before the component is mounted');
      }
      return this.chart;
    },

    componentDidMount: function (){
      this.renderChart(this.props.config);
    },

    render: function (){
      let props = this.props;
      props = {
        ...props,
        ref: 'chart'
      };
{'fraction_non_alphanumeric': 0.12783579402232625, 'fraction_numerical': 0.0, 'mean_word_length': 2.2453271028037385, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '197735', 'n_tokens_mistral': 802, 'n_tokens_neox': 781, 'n_words': 179}