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

import Container from '../../components/Container';
import SubHeader from '../../components/SubHeader';
import SubList from '../../components/SubList';
import ModalForm from '../../components/ModalForm';
import NewLinkForm from '../../components/Forms/NewLinkForm';
import LinkItem from '../../components/Link';
import Spinner from '../../components/Spinner';

import {
  setPageInfo, submitForm, postNewLink,
  loadLinks, voteLink, loadLink, loadComments
} from '../../actions';

class LinkContainer extends Component {
  componentDidMount() {
    const {
      directory,
      link,
    } = this.props.params;

    this.props.loadLink({ link });
    this.props.loadComments({ link });
  }

  componentWillReceiveProps(nextProps){
  }

  render() {
    if(!this.props.link){
      return (
        <div>No link...</div>
      );
    }

    const {
      id,
      title,
      directory,
      url,
      image,
      votes,
      upvoted,
      downvoted
    } = this.props.link;

    const {
      link
    } = this.props.params;

    return (
      <div>
      <SubHeader
        title={ this.props.params.directory }
        compact={ true }
        directory={ this.props.params.directory }
      />
      {this.props.loadingLink && (<Spinner />) || (
        <LinkItem
          onUpvote={ () => this.props.voteLink({id, vote: 'upvote'}) }
          onDownvote={ () => this.props.voteLink({id, vote: 'downvote'}) }
          upvoteDisabled={ upvoted }
          downvoteDisabled={ downvoted }
          id={ id }
          directory={ directory }
          title={ title }
          url={ url }
          image={ image }
          voteCount={ votes }
          commentCount={ 300 }
        />
      )}
      </div>
    );
  }
}

const mapStateToProps = (state, ownProps) => {

  const {
    link,
  } = ownProps.params;

  const {
    entities: { links }
  } = state;

  const linkItem = links[link];

  return {
    loadingLink: false,
    link: linkItem,
  }
}


export default connect(mapStateToProps,
  {
    setPageInfo,
    submitForm,
    postNewLink,
    loadLinks,
    voteLink,
    loadLink,
    loadComments
  }
)(LinkContainer);
<commit_msg>Try to load comments when link id props changes<commit_after>import React, { Component, PropTypes } from 'react';
import { Link } from 'react-router';
import { connect } from 'react-redux';

import Container from '../../components/Container';
import SubHeader from '../../components/SubHeader';
import SubList from '../../components/SubList';
import ModalForm from '../../components/ModalForm';
import NewLinkForm from '../../components/Forms/NewLinkForm';
import LinkItem from '../../components/Link';
import Spinner from '../../components/Spinner';

import {
  setPageInfo, submitForm, postNewLink,
  loadLinks, voteLink, loadLink, loadComments
} from '../../actions';

class LinkContainer extends Component {
  componentDidMount() {
    const {
      directory,
      link,
    } = this.props.params;

    this.loadContent({link, directory});
  }

  componentWillReceiveProps(nextProps){
    const {
      directory,
      link,
    } = nextProps.params;

    if(this.props.params.link !== link){
      this.loadContent({link, directory});
    }
  }

  loadContent({link, directory}){
    this.props.loadLink({ link });
    this.props.loadComments({ link });
  }

  render() {


    const {
      id,
      title,
      directory,
      url,
      image,
      votes,
      upvoted,
      downvoted
    } = this.props.link || {};

    const {
      link
    } = this.props.params;

    return (
      <div>
      <SubHeader
        title={ this.props.params.directory }
        compact={ true }
        directory={ this.props.params.directory }
      />
      {this.props.loadingLink && (<Spinner />) || (
        <LinkItem
          onUpvote={ () => this.props.voteLink({id, vote: 'upvote'}) }
          onDownvote={ () => this.props.voteLink({id, vote: 'downvote'}) }
          upvoteDisabled={ upvoted }
          downvoteDisabled={ downvoted }
          id={ id }
          directory={ directory }
          title={ title }
          url={ url }
          image={ image }
          voteCount={ votes }
          commentCount={ 300 }
        />
      )}
      </div>
    );
  }
}

const mapStateToProps = (state, ownProps) => {

  const {
    link,
  } = ownProps.params;

  const {
    entities: { links },
    entity
  } = state;

  const linkItem = links[link];

  return {
    loadingLink: entity.link.isFetching,
    link: linkItem,
  }
}


export default connect(mapStateToProps,
  {
    setPageInfo,
    submitForm,
    postNewLink,
    loadLinks,
    voteLink,
    loadLink,
    loadComments
  }
)(LinkContainer);

{'fraction_non_alphanumeric': 0.14335953661563922, 'fraction_numerical': 0.0012412081092263137, 'mean_word_length': 2.206233421750663, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, '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': '4107108', 'n_tokens_mistral': 1463, 'n_tokens_neox': 1443, 'n_words': 323}