<commit_before>import React, { Component } from 'react';
import { Container, Text, Content } from 'native-base';
import { connect } from 'react-redux';
import NavBar from '../../Components/NavBar';

import { fetch } from '../../Redux/Actions/places';

class PlacesScreen extends Component {

  constructor() {
    super();
    this.state = {
      isLoading: true,
    };
  }

  componentWillReceiveProps(nextProps) {
    if (nextProps.places.data !== this.props.places.data) {
      this.setState({
        isLoading: false,
      });
    }
  }

  componentDidMount() {
    this.props.fetch({
      type: 'nearby',
    });
  }

  render() {
    const { isLoading } = this.state;
    const { places } = this.props;

    return (
      <Container style={{ backgroundColor: '#2b323b' }}>
        <NavBar title="Places search" filter="category" />
        <Content style={{ height: 500 }}>
          <Text style={{ color: 'white' }}>{ isLoading ? 'loading..' : 'done.'}</Text>
          <Text style={{ color: 'white' }}>{places.data}</Text>
        </Content>
      </Container>
    );
  }
}

const mapStateToProps = state => ({
  places: state.places,
});

const mapDispatchToProps = dispatch => ({
  fetch: config => dispatch(fetch(config)),
});

export default connect(mapStateToProps, mapDispatchToProps)(PlacesScreen);<commit_msg>isLoading status dependet of store state<commit_after>import React, { Component } from 'react';
import { Container, Content, Text, Spinner } from 'native-base';
import { connect } from 'react-redux';
import NavBar from '../../Components/NavBar';

import { fetch } from '../../Redux/Actions/places';

class PlacesScreen extends Component {

  constructor() {
    super();
    this.state = {
      isLoading: true,
    };
  }

  componentWillReceiveProps(nextProps) {
    if (nextProps.places.data !== this.props.places.data) {
      this.setState({
        isLoading: false,
      });
    } else if (nextProps.places.error !== this.props.places.error) {
      this.setState({
        isLoading: false,
      });
    }
  }

  componentDidMount() {
    if (this.props.places.data) {
      this.setState({
        isLoading: false,
      });
    } else {
      this.props.fetch({
        type: 'nearby',
      });
    }
  }

  render() {
    const { isLoading } = this.state;
    const { places } = this.props;

    return (
      <Container style={{ backgroundColor: '#2b323b' }}>
        <NavBar title="Places search" filter="category" />
        <Content>
          { isLoading ? <Spinner /> : (
            <Text style={{ color: 'white' }}>{places.data}</Text>)
          }
        </Content>
      </Container>
    );
  }
}

const mapStateToProps = state => ({
  places: state.places,
});

const mapDispatchToProps = dispatch => ({
  fetch: config => dispatch(fetch(config)),
});

export default connect(mapStateToProps, mapDispatchToProps)(PlacesScreen);
{'fraction_non_alphanumeric': 0.16170360110803325, 'fraction_numerical': 0.003808864265927978, 'mean_word_length': 2.684948979591837, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 26, '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': '5613163', 'n_tokens_mistral': 899, 'n_tokens_neox': 869, 'n_words': 194}