<commit_before>import React, {PureComponent} from 'react'
import _ from 'lodash'

import {ErrorHandling} from 'src/shared/decorators/errors'
import TimeMachineVis from 'src/flux/components/TimeMachineVis'
import {getTimeSeries} from 'src/flux/apis'
import {getDeep} from 'src/utils/wrappers'

import {FluxTable, Service} from 'src/types'
import {Func} from 'src/types/flux'

interface Props {
  service: Service
  data: FluxTable[]
  index: number
  bodyID: string
  func: Func
  declarationID?: string
  script: string
}

interface State {
  data: FluxTable[]
}

@ErrorHandling
class YieldFuncNode extends PureComponent<Props, State> {
  constructor(props: Props) {
    super(props)

    this.state = {
      data: [],
    }
  }

  public componentDidMount() {
    this.getData()
  }

  public render() {
    const {func} = this.props
    const {data} = this.state<commit_msg>Render data when component recieves script update<commit_after>import React, {PureComponent} from 'react'
import _ from 'lodash'

import {ErrorHandling} from 'src/shared/decorators/errors'
import TimeMachineVis from 'src/flux/components/TimeMachineVis'
import {getTimeSeries} from 'src/flux/apis'
import {getDeep} from 'src/utils/wrappers'

import {FluxTable, Service} from 'src/types'
import {Func} from 'src/types/flux'

interface Props {
  service: Service
  data: FluxTable[]
  index: number
  bodyID: string
  func: Func
  declarationID?: string
  script: string
}

interface State {
  data: FluxTable[]
}

@ErrorHandling
class YieldFuncNode extends PureComponent<Props, State> {
  constructor(props: Props) {
    super(props)

    this.state = {
      data: [],
    }
  }

  public componentDidMount() {
    this.getData()
  }

  public componentDidUpdate(prevProps) {
    const {script: prevScript} = prevProps
    const {script: currentScript} = this.props

    if (prevScript !== currentScript) {
      this.getData()
    }
  }

  public render() {
    const {func} = this.props
    const {data} = this.state
{'fraction_non_alphanumeric': 0.11283851554663991, 'fraction_numerical': 0.0, 'mean_word_length': 3.962686567164179, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2965996', 'n_tokens_mistral': 656, 'n_tokens_neox': 643, 'n_words': 169}