<commit_before>import React from 'react';
import {connect} from 'cerebral-view-react';
import _ from 'lodash/fp';
import autosize from 'autosize';
import itemsListCountComputed from '~/computed/itemsListCountComputed';
import Items from './Items';
import styles from './styles';

export default connect({
  is_logged: 'login.is_logged',
  is_saving: 'main.is_saving',
  current_item_id: 'chatList.current_item.id',
  current_item_body: 'chatList.current_item.body',
  itemsCount: itemsListCountComputed(),
  window_size_is_mobile: 'main.window_size_is_mobile',
}, {
  redirectedToLogin: 'main.redirectedToLogin',
  currentUserRequested: 'login.currentUserRequested',
  currentItemChanged: 'chatList.currentItemChanged',
  currentItemSubmitted: 'chatList.currentItemSubmitted',

  updateItemSubmitted: 'chatList.updateItemSubmitted',
  editCanceled: 'chatList.editCanceled',
},
  class ChatList extends React.Component {

    static autosizeLoaded = false;

    componentDidMount() {
      if (!this.props.is_logged) {
        this.props.redirectedToLogin();
      }
    }

    componentDidUpdate(prevProps) {
      // redirect to login if is_logged === false
      if (prevProps.is_logged !== this.props.is_logged) {
        if (!this.props.is_logged) {
          this.props.redirectedToLogin();
        }
      }<commit_msg>[chatList] scroll to bottom at start<commit_after>import React from 'react';
import {connect} from 'cerebral-view-react';
import _ from 'lodash/fp';
import autosize from 'autosize';
import itemsListCountComputed from '~/computed/itemsListCountComputed';
import Items from './Items';
import styles from './styles';

export default connect({
  is_logged: 'login.is_logged',
  is_saving: 'main.is_saving',
  current_item_id: 'chatList.current_item.id',
  current_item_body: 'chatList.current_item.body',
  itemsCount: itemsListCountComputed(),
  window_size_is_mobile: 'main.window_size_is_mobile',
  all_loaded: 'main.all_loaded',
}, {
  redirectedToLogin: 'main.redirectedToLogin',
  currentUserRequested: 'login.currentUserRequested',
  currentItemChanged: 'chatList.currentItemChanged',
  currentItemSubmitted: 'chatList.currentItemSubmitted',

  updateItemSubmitted: 'chatList.updateItemSubmitted',
  editCanceled: 'chatList.editCanceled',
},
  class ChatList extends React.Component {

    static autosizeLoaded = false;

    componentDidMount() {
      if (!this.props.is_logged) {
        this.props.redirectedToLogin();
      }
      this.messagesNode.scrollTop = this.messagesNode.scrollHeight;
    }

    componentDidUpdate(prevProps) {
      // redirect to login if is_logged === false
      if (prevProps.is_logged !== this.props.is_logged) {
        if (!this.props.is_logged) {
          this.props.redirectedToLogin();
        }
      }
{'fraction_non_alphanumeric': 0.11571737563085796, 'fraction_numerical': 0.0, 'mean_word_length': 4.46259842519685, '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': '4717492', 'n_tokens_mistral': 888, 'n_tokens_neox': 861, 'n_words': 165}