<commit_before>const bindAll = require('lodash.bindall');
const React = require('react');

const SpriteSelectorComponent = require('../components/sprite-selector');

class SpriteSelector extends React.Component {
    constructor (props) {
        super(props);
        bindAll(this, ['onChange', 'targetsUpdate']);
        this.state = {
            targets: {
                targetList: []
            }
        };
    }
    componentDidMount () {
        this.props.vm.on('targetsUpdate', this.targetsUpdate);
    }
    onChange (event) {
        this.props.vm.setEditingTarget(event.target.value);
    }
    targetsUpdate (data) {
        this.setState({targets: data});
    }
    render () {
        return (
            <SpriteSelectorComponent
                value={[this.state.targets.editingTarget]}
                onChange={this.onChange}
                sprites={this.state.targets.targetList.map(target => (
                    {
                        id: target[0],
                        name: target[1]
                    }
                ))}
            />
        );
    }
}

SpriteSelector.propTypes = {
    vm: React.PropTypes.object.isRequired
};

module.exports = SpriteSelector;<commit_msg>Account for null editingTarget<commit_after>const bindAll = require('lodash.bindall');
const React = require('react');

const SpriteSelectorComponent = require('../components/sprite-selector');

class SpriteSelector extends React.Component {
    constructor (props) {
        super(props);
        bindAll(this, ['onChange', 'targetsUpdate']);
        this.state = {
            targets: {
                targetList: []
            }
        };
    }
    componentDidMount () {
        this.props.vm.on('targetsUpdate', this.targetsUpdate);
    }
    onChange (event) {
        this.props.vm.setEditingTarget(event.target.value);
    }
    targetsUpdate (data) {
        this.setState({targets: data});
    }
    render () {
        return (
            <SpriteSelectorComponent
                value={this.state.targets.editingTarget && [this.state.targets.editingTarget]}
                onChange={this.onChange}
                sprites={this.state.targets.targetList.map(target => (
                    {
                        id: target[0],
                        name: target[1]
                    }
                ))}
            />
        );
    }
}

SpriteSelector.propTypes = {
    vm: React.PropTypes.object.isRequired
};

module.exports = SpriteSelector;
{'fraction_non_alphanumeric': 0.12404656764351665, 'fraction_numerical': 0.0016057808109193096, 'mean_word_length': 1.7475192943770672, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '1765098', 'n_tokens_mistral': 688, 'n_tokens_neox': 661, 'n_words': 97}