<commit_before>import React from 'react'
import { connect } from 'react-redux'
import A from './A'
import Avatar from './Avatar'
import cx from 'classnames'
import { isEmpty, get } from 'lodash'
import { hideTagPopover, fetchTagSummary, followTag } from '../actions/index'
const { string, object, func, array, number, bool } = React.PropTypes

const nounCount = (n, noun) => `${n} ${noun}${Number(n) !== 1 ? 's' : ''}`

@connect(({ tagPopover: { slug, tagName, position, anchorWidth }, tagsByCommunity }) => {
  let tag = get(tagsByCommunity, [slug, tagName])
  return {
    tagName,
    slug,
    position,
    anchorWidth,
    followed: get(tag, 'followed'),
    description: get(tag, 'description'),
    postCount: get(tag, 'post_count'),
    followerCount: get(tag, 'follower_count'),
    activeMembers: get(tag, 'active_members')
  }
})
export default class TagPopover extends React.Component {

  static propTypes = {
    dispatch: func,
    tagName: string,
    slug: string,
    description: string,
    postCount: string,
    followerCount: number,
    activeMembers: array,
    position: object,
    anchorWidth: number,
    followed: bool
  }

  hide () {
    let { dispatch } = this.props
    dispatch(hideTagPopover())
  }

  removeHideTimeout () {
    if (this.hideTimeoutId) {
      clearTimeout(this.hideTimeoutId)
      this.hideTimeoutId = null
    }
  }

  componentWillReceiveProps (nextProps) {
    let { dispatch, slug, tagName } = this.props

    // hidden
    if (isEmpty(nextProps.tagName)) return

    // loading
    if (nextProps.tagName !== tagName || nextProps.slug !== slug) {
      dispatch(fetchTagSummary(nextProps.tagName, nextProps.slug))
    }

    // content has loaded
    if (nextProps.description) {
      this.hideTimeoutId = setTimeout(() => this.hide(), 3000)
    }
  }

  render () {
    let { slug, tagName, description, postCount, followerCount,
      activeMembers, position, anchorWidth, followed, dispatch } = this.props
<commit_msg>fix timeout bug<commit_after>import React from 'react'
import { connect } from 'react-redux'
import A from './A'
import Avatar from './Avatar'
import cx from 'classnames'
import { isEmpty, get } from 'lodash'
import { hideTagPopover, fetchTagSummary, followTag } from '../actions/index'
const { string, object, func, array, number, bool } = React.PropTypes

const nounCount = (n, noun) => `${n} ${noun}${Number(n) !== 1 ? 's' : ''}`

@connect(({ tagPopover: { slug, tagName, position, anchorWidth }, tagsByCommunity }) => {
  let tag = get(tagsByCommunity, [slug, tagName])
  return {
    tagName,
    slug,
    position,
    anchorWidth,
    followed: get(tag, 'followed'),
    description: get(tag, 'description'),
    postCount: get(tag, 'post_count'),
    followerCount: get(tag, 'follower_count'),
    activeMembers: get(tag, 'active_members')
  }
})
export default class TagPopover extends React.Component {

  static propTypes = {
    dispatch: func,
    tagName: string,
    slug: string,
    description: string,
    postCount: string,
    followerCount: string,
    activeMembers: array,
    position: object,
    anchorWidth: number,
    followed: bool
  }

  hide () {
    let { dispatch } = this.props
    dispatch(hideTagPopover())
  }

  removeHideTimeout () {
    if (this.hideTimeoutId) {
      clearTimeout(this.hideTimeoutId)
      this.hideTimeoutId = null
    }
  }

  componentWillReceiveProps (nextProps) {
    let { dispatch, slug, tagName } = this.props

    // hidden
    if (isEmpty(nextProps.tagName)) return

    // loading
    if (nextProps.tagName !== tagName || nextProps.slug !== slug) {
      dispatch(fetchTagSummary(nextProps.tagName, nextProps.slug))
    }

    // content has loaded
    if (nextProps.description) {
      this.removeHideTimeout()
      this.hideTimeoutId = setTimeout(() => this.hide(), 3000)
    }
  }

  render () {
    let { slug, tagName, description, postCount, followerCount,
      activeMembers, position, anchorWidth, followed, dispatch } = this.props

{'fraction_non_alphanumeric': 0.13184888666499875, 'fraction_numerical': 0.002501876407305479, 'mean_word_length': 3.4079382579933846, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5274904', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1236, 'n_words': 321}