<commit_before>var ViewComponent = require('ui/viewcomponent');

module.exports = ViewComponent('ViewMain', {
  getInitialState() {
    return { inactive: false };
  },

  componentDidMount() {
    // todo: better way to determine null component?
    var children = this.refs.ViewMain.getDOMNode().children;
    if (children.length === 1 && children[0].tagName === 'NOSCRIPT')
      this.setState({ inactive: true });
  },

  render() {
    var { children, hasChild, ...props } = this.props;

    if (!children)
      this.addStyles(this.styles.childless);

    this.addStyles({
      zIndex: this.getZIndexForLayer() + 50
    });

    if (this.state.inactive || this.props.inactive)
      this.addStyles({ pointerEvents: 'none' });

    return (
      <div {...props} {...this.componentProps()}>
        {children}
      </div>
    );
  }
});<commit_msg>Bugfix viewmain sets inactive on changed props<commit_after>var ViewComponent = require('ui/viewcomponent');

module.exports = ViewComponent('ViewMain', {
  getInitialState() {
    return { inactive: false };
  },

  componentDidMount() {
    this.setInactiveIfNoChildren();
  },

  componentDidReceiveProps() {
    this.setInactiveIfNoChildren();
  },

  setInactiveIfNoChildren() {
    // todo: better way to determine null component?
    var children = this.refs.ViewMain.getDOMNode().children;
    if (children.length === 1 && children[0].tagName === 'NOSCRIPT')
      this.setState({ inactive: true });
  },

  render() {
    var { children, hasChild, ...props } = this.props;

    if (!children)
      this.addStyles(this.styles.childless);

    this.addStyles({
      zIndex: this.getZIndexForLayer() + 50
    });

    if (this.state.inactive || this.props.inactive)
      this.addStyles({ pointerEvents: 'none' });

    return (
      <div {...props} {...this.componentProps()}>
        {children}
      </div>
    );
  }
});
{'fraction_non_alphanumeric': 0.16101694915254236, 'fraction_numerical': 0.00423728813559322, 'mean_word_length': 2.9936575052854124, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6182209', 'n_tokens_mistral': 604, 'n_tokens_neox': 578, 'n_words': 116}