<commit_before>import React from "react";
import {render} from "react-dom";
import {connect} from "react-redux";
import HttpService from "../http/HttpService";
import InlinedSvgs from '../assets/icons/InlinedSvgs'

class HealthCheck extends React.Component {

  constructor(props) {
    super(props);
    this.state = {healthCheck: {state: 'error', error: 'State unknown'}};
  }

  componentWillMount() {
    HttpService.fetchHealthCheck().then((check) => this.setState({healthCheck: check}))
  }

  render() {
    return !this.state.healthCheck || this.state.healthCheck.error ?
      (<div className="healthCheck">
        <div className="icon" title="Warning" dangerouslySetInnerHTML={{__html: InlinedSvgs.tipsWarning}} />
        <span className="errorText">{this.state.healthCheck.error}</span>
      </div>) : null

  }
}

export default HealthCheck;<commit_msg>Fix: unknown state in HealthCheck<commit_after>import React from "react";
import {render} from "react-dom";
import {connect} from "react-redux";
import HttpService from "../http/HttpService";
import InlinedSvgs from '../assets/icons/InlinedSvgs'

class HealthCheck extends React.Component {

  constructor(props) {
    super(props);

    this.state = {
      healthCheck: undefined,
    };
  }

  componentDidMount() {
    HttpService.fetchHealthCheck().then(
      (check) => this.setState({ healthCheck: check })
    );
  }

  render() {
    const { healthCheck } = this.state;
    if (!healthCheck || !healthCheck.error) {
      return null;
    }

    return (
      <div className="healthCheck">
        <div className="icon" title="Warning" dangerouslySetInnerHTML={{__html: InlinedSvgs.tipsWarning}} />
        <span className="errorText">{healthCheck.error}</span>
      </div>
    );

  }
}

export default HealthCheck;
{'fraction_non_alphanumeric': 0.1447661469933185, 'fraction_numerical': 0.0, 'mean_word_length': 3.8306451612903225, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '506547', 'n_tokens_mistral': 538, 'n_tokens_neox': 535, 'n_words': 116}