<commit_before>import React from 'react';

export default class OfflineIndicator extends React.Component {
  state = {
    isOffline: false,
  };

  componentDidMount() {
    this.timer = setInterval(() => {
      fetch('https://www.google.com/generate_204', { mode: 'no-cors' })
        .then(res => {
          // with no-cors, res.status is 0 because the javascript ignores all response.
          // we don't need the response, all we need to know is if the request went through or not
          if (res.status !== 204) {
            this.setState({ isOffline: false });
          }
        })
        .catch(() => {
          this.setState({ isOffline: true });
        });
    }, 5000);
  }

  componentWillUnmount() {
    clearInterval(this.timer);
  }

  render() {
    return this.state.isOffline && <p>You are offline. Changes {"won't"} be saved</p>;
  }
}<commit_msg>[#3624] - remove redundant if statement<commit_after>import React from 'react';

export default class OfflineIndicator extends React.Component {
  state = {
    isOffline: false,
  };

  componentDidMount() {
    this.timer = setInterval(() => {
      fetch('https://www.google.com/generate_204', { mode: 'no-cors' })
        .then(() => {
          this.setState({ isOffline: false });
        })
        .catch(() => {
          this.setState({ isOffline: true });
        });
    }, 5000);
  }

  componentWillUnmount() {
    clearInterval(this.timer);
  }

  render() {
    return this.state.isOffline && <p>You are offline. Changes {"won't"} be saved</p>;
  }
}
{'fraction_non_alphanumeric': 0.15414507772020725, 'fraction_numerical': 0.014248704663212436, 'mean_word_length': 2.4030837004405288, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '4940309', 'n_tokens_mistral': 497, 'n_tokens_neox': 466, 'n_words': 116}