<commit_before>import React from 'react'
import { parsePost } from '../parsers/PostParser'

class PostsAsGrid extends React.Component {
  static propTypes = {
    posts: React.PropTypes.object,
    json: React.PropTypes.object,
    currentUser: React.PropTypes.object,
    gridColumnCount: React.PropTypes.number,
  }

  renderColumn(posts) {
    const { json, currentUser } = this.props
    return (
      <div className="Column">
        {posts.map((post) => {
          return (
            <article ref={`postGrid_${post.id}`} key={post.id} className="Post PostGrid">
              {parsePost(post, json, currentUser)}
            </article>
          )
        })}
      </div>
    )
  }

  render() {
    const { posts, gridColumnCount } = this.props
    if (!gridColumnCount) { return null }
    const columns = []
    for (let i = 0; i < gridColumnCount; i++) {
      columns.push([])
    }
    for (const index in posts.data) {
      if (posts.data[index]) {
        columns[index % gridColumnCount].push(posts.data[index])
      }
    }
    return (
      <div className="Posts asGrid">
        {columns.map((column) => {
          return this.renderColumn(column)
        })}
      </div>
    )
  }
}

export default PostsAsGrid
<commit_msg>Fix an issue with grid post rendering.<commit_after>import React from 'react'
import { parsePost } from '../parsers/PostParser'

class PostsAsGrid extends React.Component {
  static propTypes = {
    posts: React.PropTypes.object,
    json: React.PropTypes.object,
    currentUser: React.PropTypes.object,
    gridColumnCount: React.PropTypes.number,
  }

  renderColumn(posts, index) {
    const { json, currentUser } = this.props
    return (
      <div className="Column" key={`column_${index}`}>
        {posts.map((post) => {
          return (
            <article ref={`postGrid_${post.id}`} key={post.id} className="Post PostGrid">
              {parsePost(post, json, currentUser)}
            </article>
          )
        })}
      </div>
    )
  }

  render() {
    const { posts, gridColumnCount } = this.props
    if (!gridColumnCount) { return null }
    const columns = []
    for (let i = 0; i < gridColumnCount; i++) {
      columns.push([])
    }
    for (const index in posts.data) {
      if (posts.data[index]) {
        columns[index % gridColumnCount].push(posts.data[index])
      }
    }
    return (
      <div className="Posts asGrid">
        {columns.map((column, index) => {
          return this.renderColumn(column, index)
        })}
      </div>
    )
  }
}

export default PostsAsGrid

{'fraction_non_alphanumeric': 0.13752913752913754, 'fraction_numerical': 0.000777000777000777, 'mean_word_length': 2.3268733850129197, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, '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': '4210627', 'n_tokens_mistral': 794, 'n_tokens_neox': 780, 'n_words': 172}