<commit_before>import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { TabPanel } from 'react-tabs';
import _ from 'lodash';
import elementResizeEvent, { unbind } from '../lib/element-resize-event';
import visibleArea from '../visibleArea';

const DEFAULT_CLASS = 'react-tabs__tab-panel';

export default class Comp extends TabPanel {
  constructor(props) {
    super(props);
  }

  onResize() {
    const node = ReactDOM.findDOMNode(this);
    node.style.height = null;
    const {height} = visibleArea(node);
    if(height) {
      node.style.height = `${height}px`;
    }
  }

  componentDidMount() {
    if( typeof window !== 'undefined' ) {
      // const elementResizeEvent = require('../lib/element-resize-event');
      const node = ReactDOM.findDOMNode(this);
      elementResizeEvent(node, this.onResize.bind(this));
    }
  }
}<commit_msg>Fix mounting issue<commit_after>import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { TabPanel } from 'react-tabs';
import _ from 'lodash';
import elementResizeEvent, { unbind } from '../lib/element-resize-event';
import visibleArea from '../visibleArea';

const DEFAULT_CLASS = 'react-tabs__tab-panel';

export default class Comp extends TabPanel {
  constructor(props) {
    super(props);
  }

  onResize() {
    if(this.mounted) {
      const node = ReactDOM.findDOMNode(this);
      node.style.height = null;
      const {height} = visibleArea(node);
      if(height) {
        node.style.height = `${height}px`;
      }

    }

  }

  componentDidMount() {
    if( typeof window !== 'undefined' ) {
      // const elementResizeEvent = require('../lib/element-resize-event');
      const node = ReactDOM.findDOMNode(this);
      elementResizeEvent(node, this.onResize.bind(this));
    }
    this.mounted = true;
  }
  componentWillUnmount() {
    this.mounted = false;
  }
}
{'fraction_non_alphanumeric': 0.14247881355932204, 'fraction_numerical': 0.0, 'mean_word_length': 3.372685185185185, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3596597', 'n_tokens_mistral': 584, 'n_tokens_neox': 582, 'n_words': 130}