<commit_before>import * as React from 'react'
import { Commit } from '../../lib/local-git-operations'
import CommitListItem from './commit-list-item'
import List from '../list'

interface ICommitListProps {
  readonly onCommitSelected: (commit: Commit) => void
  readonly commits: ReadonlyArray<Commit>
  readonly selectedCommit: Commit | null
}

/** A component which displays the list of commits. */
export default class CommitList extends React.Component<ICommitListProps, void> {
  private renderCommit(row: number) {
    const commit = this.props.commits[row]
    return <CommitListItem commit={commit} key={commit.sha}/>
  }

  private onSelectionChanged(row: number) {
    const commit = this.props.commits[row]
    this.props.onCommitSelected(commit)
  }

  private rowForCommit(commit_: Commit | null): number {
    const commit = commit_
    if (!commit) { return -1 }

    let index = 0
    this.props.commits.forEach((c, i) => {
      if (c.sha === commit.sha) {
        index = i
        return
      }
    })
    return index
  }

  public render() {
    return (
      <div className='panel' id='commit-list'>
        <List rowCount={this.props.commits.length}
              rowHeight={68}
              selectedRow={this.rowForCommit(this.props.selectedCommit)}
              rowRenderer={row => this.renderCommit(row)}
              onSelectionChanged={row => this.onSelectionChanged(row)}/>
      </div>
    )
  }
}<commit_msg>The commits list factors into invalidation<commit_after>import * as React from 'react'
import { Commit } from '../../lib/local-git-operations'
import CommitListItem from './commit-list-item'
import List from '../list'

interface ICommitListProps {
  readonly onCommitSelected: (commit: Commit) => void
  readonly commits: ReadonlyArray<Commit>
  readonly selectedCommit: Commit | null
}

/** A component which displays the list of commits. */
export default class CommitList extends React.Component<ICommitListProps, void> {
  private renderCommit(row: number) {
    const commit = this.props.commits[row]
    return <CommitListItem commit={commit} key={commit.sha}/>
  }

  private onSelectionChanged(row: number) {
    const commit = this.props.commits[row]
    this.props.onCommitSelected(commit)
  }

  private rowForCommit(commit_: Commit | null): number {
    const commit = commit_
    if (!commit) { return -1 }

    let index = 0
    this.props.commits.forEach((c, i) => {
      if (c.sha === commit.sha) {
        index = i
        return
      }
    })
    return index
  }

  public render() {
    return (
      <div className='panel' id='commit-list'>
        <List rowCount={this.props.commits.length}
              rowHeight={68}
              selectedRow={this.rowForCommit(this.props.selectedCommit)}
              rowRenderer={row => this.renderCommit(row)}
              onSelectionChanged={row => this.onSelectionChanged(row)}
              invalidationProps={this.props.commits}/>
      </div>
    )
  }
}
{'fraction_non_alphanumeric': 0.12281292059219381, 'fraction_numerical': 0.0026917900403768506, 'mean_word_length': 2.958721704394141, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, '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': '4606286', 'n_tokens_mistral': 865, 'n_tokens_neox': 870, 'n_words': 212}