<commit_before>import React from 'react';
import {
  Cell, Column, Table, TruncatedFormat,
} from '@blueprintjs/table';
import { csvContextLoader } from 'src/components/common';

import './TableViewer.scss';


class TableViewer extends React.Component {
  constructor(props) {
    super(props);
    this.renderCell = this.renderCell.bind(this);
    this.onVisibleCellsChange = this.onVisibleCellsChange.bind(this);
  }

  onVisibleCellsChange(row) {
    const { fetchMoreRows, requestedRow } = this.props;
    // If we are scrolling to the end. Time to load more rows.
    if ((row.rowIndexEnd + 50) > requestedRow) {
      fetchMoreRows()
    }
  }<commit_msg>force reload tableViewer when csv data is processed<commit_after>import React from 'react';
import {
  Cell, Column, Table, TruncatedFormat,
} from '@blueprintjs/table';
import { csvContextLoader } from 'src/components/common';

import './TableViewer.scss';


class TableViewer extends React.Component {
  constructor(props) {
    super(props);
    this.renderCell = this.renderCell.bind(this);
    this.onVisibleCellsChange = this.onVisibleCellsChange.bind(this);
  }

  componentDidUpdate(prevProps) {
    // Blueprint Table doesn't consistently re-render on initial data load.
    //  so force reloads the component to render the table correctly with incoming data
    const initialDataLoad = prevProps.rows.length === 0 && this.props.rows.length !== 0;
    if (initialDataLoad) {
      this.forceUpdate();
    }
  }

  onVisibleCellsChange(row) {
    const { fetchMoreRows, requestedRow } = this.props;
    // If we are scrolling to the end. Time to load more rows.
    if ((row.rowIndexEnd + 50) > requestedRow) {
      fetchMoreRows()
    }
  }
{'fraction_non_alphanumeric': 0.11104617182933957, 'fraction_numerical': 0.0035067212156633548, 'mean_word_length': 3.729281767955801, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7533607', 'n_tokens_mistral': 529, 'n_tokens_neox': 503, 'n_words': 137}