<commit_before>import React, { Component } from 'react'
import Die from './Die'
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import './styles.scss'

export default class DiceContainer extends Component {

  constructor(props) {
    super(props)
    this.state = {
      totalValue: props.numDice * 6
    }
    this.dice = []
    this.rollCount = 0

    this.rollDone = this.rollDone.bind(this)
    this.rollAll = this.rollAll.bind(this)
    this.getDiceTotal = this.getDiceTotal.bind(this)

  }

  rollAll() {
    this.rollCount = 0
    for (let die of this.dice) {
      if(die !== null) {
        this.rollCount++
        die.rollDie()
      }
    }
  }

  rollDone() {
    this.rollCount--;
    if (this.rollCount <= 0) {
      this.getDiceTotal()
    }
  }

  getDiceTotal() {
    let total = 0
    for (let die of this.dice) {
      if(die !== null) {
        total += die.getValue()
      }
    }
    this.setState({totalValue: total})
    this.props.totalCb(total)
  }

  componentDidMount() {
    this.props.totalCb(this.state.totalValue)
  }

  componentDidUpdate(prevProps, prevState) {
    if (prevProps.numDice !== this.props.numDice) {
      this.getDiceTotal()
    }
  }

  render() {
    let { props } = this
    let dice = []<commit_msg>Removed pre-roll (componentDidMount) firing of totals callback<commit_after>import React, { Component } from 'react'
import Die from './Die'
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import './styles.scss'

export default class DiceContainer extends Component {

  constructor(props) {
    super(props)
    this.state = {
      totalValue: props.numDice * 6
    }
    this.dice = []
    this.rollCount = 0

    this.rollDone = this.rollDone.bind(this)
    this.rollAll = this.rollAll.bind(this)
    this.getDiceTotal = this.getDiceTotal.bind(this)

  }

  rollAll() {
    this.rollCount = 0
    for (let die of this.dice) {
      if(die !== null) {
        this.rollCount++
        die.rollDie()
      }
    }
  }

  rollDone() {
    this.rollCount--;
    if (this.rollCount <= 0) {
      this.getDiceTotal()
    }
  }

  getDiceTotal() {
    let total = 0
    for (let die of this.dice) {
      if(die !== null) {
        total += die.getValue()
      }
    }
    this.setState({totalValue: total})
    this.props.totalCb(total)
  }

  componentDidUpdate(prevProps, prevState) {
    if (prevProps.numDice !== this.props.numDice) {
      this.getDiceTotal()
    }
  }

  render() {
    let { props } = this
    let dice = []
{'fraction_non_alphanumeric': 0.13452380952380952, 'fraction_numerical': 0.003968253968253968, 'mean_word_length': 2.4021592442645074, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '312568', 'n_tokens_mistral': 889, 'n_tokens_neox': 867, 'n_words': 172}