<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import Helmet from 'react-helmet';
import equal from 'fast-deep-equal';
//
import AbstractContextComponent from '../AbstractContextComponent/AbstractContextComponent';
import PageHeader from '../PageHeader/PageHeader';
import ContentHeader from '../ContentHeader/ContentHeader';
import Icon from '../Icon/Icon';
import ConfigurationManager from '../../../redux/data/ConfigurationManager';
import { selectNavigationItems, selectNavigationItem, getNavigationItem, hideFooter } from '../../../redux/config/actions';

/**
* Basic content = page representation
* Requires store and router context
*
* @author <NAME>
*/
export default class AbstractContent extends AbstractContextComponent {

  /**
   * Don't forget to call super.componentDidMount() in subclass
   * - solves selected navigation by defined navigation key
   * - solves hide footer
   *
   * @return
   */
  componentDidMount() {
    if (this.getNavigationKey()) {
      this.selectNavigationItem(this.getNavigationKey());
    }
    if (this.hideFooter()) {
      this.context.store.dispatch(hideFooter(true));
    }
  }

  /**
  * Method for stop redundant component rendering. This is very naive implementation, where are checked changes on props and state.
  * This check should not have any inpact on count of rendering, but has big.
  * Check with deep transform objects to string is not recommendit for bad performence, but for us is that very usefull.
  */
  shouldComponentUpdate(nextProps, nextState) {
    // return true;
    if (nextProps && (
      !equal(nextProps, this.props)
    )) {
      return true;
    }

    if (nextState && (
      !equal(nextState, this.state)
    )) {
      return true;
    }
    return false;
  }

  /**
   * Don't forget to call super.componentWillUnmount() in subclass
   * - solves hide footer<commit_msg>#1901 - React components are rendering too many times - PureComponent<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import Helmet from 'react-helmet';
import equal from 'fast-deep-equal';
//
import AbstractContextComponent from '../AbstractContextComponent/AbstractContextComponent';
import PageHeader from '../PageHeader/PageHeader';
import ContentHeader from '../ContentHeader/ContentHeader';
import Icon from '../Icon/Icon';
import ConfigurationManager from '../../../redux/data/ConfigurationManager';
import { selectNavigationItems, selectNavigationItem, getNavigationItem, hideFooter } from '../../../redux/config/actions';

/**
* Basic content = page representation
* Requires store and router context
*
* @author <NAME>
*/
export default class AbstractContent extends AbstractContextComponent {

  /**
   * Don't forget to call super.componentDidMount() in subclass
   * - solves selected navigation by defined navigation key
   * - solves hide footer
   *
   * @return
   */
  componentDidMount() {
    if (this.getNavigationKey()) {
      this.selectNavigationItem(this.getNavigationKey());
    }
    if (this.hideFooter()) {
      this.context.store.dispatch(hideFooter(true));
    }
  }

  /**
   * Don't forget to call super.componentWillUnmount() in subclass
   * - solves hide footer
{'fraction_non_alphanumeric': 0.11404599129894344, 'fraction_numerical': 0.001243008079552517, 'mean_word_length': 3.7338235294117648, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1570442', 'n_tokens_mistral': 859, 'n_tokens_neox': 835, 'n_words': 268}