<commit_before>import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { routeActions } from 'react-router-redux';
import { LoginForm } from 'components';

@connect(state => ({user: state.auth.user}), {pushState: routeActions.push})
export default class AuthorizedApp extends Component {
  static propTypes = {
    children: PropTypes.object.isRequired,
    location: PropTypes.object.isRequired,
    user: PropTypes.object,
    pushState: PropTypes.func.isRequired
  };

  constructor(props) {
    super(props);
    this.state = {showChildren: Boolean(props.user)};
  }

  componentWillReceiveProps(nextProps) {
    if (this.props.user !== nextProps.user) {
      // to reload asyncConnect data and block transition until data is loaded, we need to reload route
      this.props.pushState(nextProps.location.pathname);
    }

    if (this.props.location !== nextProps.location) {
      // We should update showChildren only after redirect is completed
      this.setState({showChildren: Boolean(nextProps.user)});
    }
  }

  shouldComponentUpdate(nextProps, nextState) {
    return this.state.showChildren !== nextState.showChildren;
  }

  render() {
    const { showChildren } = this.state;
    const styles = require('./AuthorizedApp.scss');

    return (
      showChildren ? this.props.children :
        <div className={styles.unauthorized}>
          <h1>Access denied</h1>
          <LoginForm />
        </div>
    );
  }
}
<commit_msg>small AythorizedApp fix - update if children changed<commit_after>import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { routeActions } from 'react-router-redux';
import { LoginForm } from 'components';

@connect(state => ({user: state.auth.user}), {pushState: routeActions.push})
export default class AuthorizedApp extends Component {
  static propTypes = {
    children: PropTypes.object.isRequired,
    location: PropTypes.object.isRequired,
    user: PropTypes.object,
    pushState: PropTypes.func.isRequired
  };

  constructor(props) {
    super(props);
    this.state = {showChildren: Boolean(props.user)};
  }

  componentWillReceiveProps(nextProps) {
    if (this.props.user !== nextProps.user) {
      // to reload asyncConnect data and block transition until data is loaded, we need to reload route
      this.props.pushState(nextProps.location.pathname);
    }

    if (this.props.location !== nextProps.location) {
      // We should update showChildren only after redirect is completed
      this.setState({showChildren: Boolean(nextProps.user)});
    }
  }

  shouldComponentUpdate(nextProps, nextState) {
    return this.state.showChildren !== nextState.showChildren || this.props.children !== nextProps.children;
  }

  render() {
    const { showChildren } = this.state;
    const styles = require('./AuthorizedApp.scss');

    return (
      showChildren ? this.props.children :
        <div className={styles.unauthorized}>
          <h1>Access denied</h1>
          <LoginForm />
        </div>
    );
  }
}

{'fraction_non_alphanumeric': 0.12096511248777307, 'fraction_numerical': 0.0013042060645582002, 'mean_word_length': 3.433526011560694, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '3739727', 'n_tokens_mistral': 875, 'n_tokens_neox': 867, 'n_words': 208}