<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { withRouter } from 'react-router';
import Disqus from 'react-disqus-thread';
import { postLoad } from 'actions/postActions';
import Post from 'front/components/Post';

class PostPage extends React.Component {
  static propTypes = {
    post: PropTypes.object
  };

  constructor(props) {
    super(props);
    this.id = parseInt(props.match.params.id, 10);
    props.dispatch(postLoad(this.id));
  }

  componentDidMount() {
    window.scrollTo(0, 0);
  }

  componentDidUpdate() {
    document.title = `${this.props.post.title} - headzoo.io`;
  }

  render() {
    const { post } = this.props;
    if (!post.title) {
      return null;
    }

    return (
      <div>
        <Post key={post.id} post={post} readMore={false} />
        <article>
          <Disqus
            shortname="headzoo-io"
            title={post.title}
            identifier={`posts_${post.id}`}
          />
        </article>
      </div>
    );
  }
}


function mapStateToProps(state) {
  return Object.assign({}, { post: state.post });
}

export default withRouter(connect(mapStateToProps)(PostPage));
<commit_msg>Adds loading to post page<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { withRouter } from 'react-router';
import Disqus from 'react-disqus-thread';
import { postLoad } from 'actions/postActions';
import Post from 'front/components/Post';
import Loading from 'common/Loading';

class PostPage extends React.Component {
  static propTypes = {
    post: PropTypes.object
  };

  constructor(props) {
    super(props);
    this.id = parseInt(props.match.params.id, 10);
    props.dispatch(postLoad(this.id));
  }

  componentDidMount() {
    window.scrollTo(0, 0);
  }

  componentDidUpdate() {
    document.title = `${this.props.post.title} - headzoo.io`;
  }

  render() {
    const { post } = this.props;

    if (post.isFetching || post.id === 0) {
      return (
        <article>
          <Loading />
        </article>
      );
    }

    return (
      <div>
        <Post key={post.id} post={post} readMore={false} />
        <article>
          <Disqus
            shortname="headzoo-io"
            title={post.title}
            identifier={`posts_${post.id}`}
          />
        </article>
      </div>
    );
  }
}


function mapStateToProps(state) {
  return Object.assign({}, { post: state.post });
}

export default withRouter(connect(mapStateToProps)(PostPage))

{'fraction_non_alphanumeric': 0.146568437378829, 'fraction_numerical': 0.0034897246994959287, 'mean_word_length': 2.6909871244635193, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, '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': '5914710', 'n_tokens_mistral': 833, 'n_tokens_neox': 822, 'n_words': 170}