<commit_before>import React from "react";
import {PropTypes, Component} from "react";
import classNames from "classnames";
import AccountActions from "actions/AccountActions";
import AccountStore from "stores/AccountStore";
import {debounce} from "lodash";
import BaseComponent from "../BaseComponent";
import validation from "common/validation";

class AccountNameInput extends BaseComponent {

    static propTypes = {
        id: PropTypes.string,
        placeholder: PropTypes.string,
        initial_value: PropTypes.string,
        onChange: PropTypes.func,
        onEnter: PropTypes.func,
        accountShouldExist: PropTypes.bool,
        accountShouldNotExist: PropTypes.bool,
        cheapNameOnly: PropTypes.bool
    };
    
    constructor(props) {
        super(props, AccountStore);
        this.state.value = null;
        this.state.error = null;
        this.state.existing_account = false;
        this.handleChange = this.handleChange.bind(this);
        this.onKeyDown = this.onKeyDown.bind(this);
        this.validateAccountName = debounce(this.validateAccountName, 250);
    }

    shouldComponentUpdate(nextProps, nextState) {
        return nextState.value !== this.state.value
               || nextState.error !== this.state.error
               || nextState.account_name !== this.state.account_name
               || nextState.existing_account !== this.state.existing_account
               || nextState.searchAccounts !== this.state.searchAccounts
    }

    componentDidUpdate() {
        if (this.props.onChange) this.props.onChange({valid: !this.getError()});
    }

    value() {<commit_msg>Removes debounce to give account name reg identicon responsive updating<commit_after>import React from "react";
import {PropTypes, Component} from "react";
import classNames from "classnames";
import AccountActions from "actions/AccountActions";
import AccountStore from "stores/AccountStore";
import BaseComponent from "../BaseComponent";
import validation from "common/validation";

class AccountNameInput extends BaseComponent {

    static propTypes = {
        id: PropTypes.string,
        placeholder: PropTypes.string,
        initial_value: PropTypes.string,
        onChange: PropTypes.func,
        onEnter: PropTypes.func,
        accountShouldExist: PropTypes.bool,
        accountShouldNotExist: PropTypes.bool,
        cheapNameOnly: PropTypes.bool
    };
    
    constructor(props) {
        super(props, AccountStore);
        this.state.value = null;
        this.state.error = null;
        this.state.existing_account = false;
        this.handleChange = this.handleChange.bind(this);
        this.onKeyDown = this.onKeyDown.bind(this);
    }

    shouldComponentUpdate(nextProps, nextState) {
        return nextState.value !== this.state.value
               || nextState.error !== this.state.error
               || nextState.account_name !== this.state.account_name
               || nextState.existing_account !== this.state.existing_account
               || nextState.searchAccounts !== this.state.searchAccounts
    }

    componentDidUpdate() {
        if (this.props.onChange) this.props.onChange({valid: !this.getError()});
    }

    value() {
{'fraction_non_alphanumeric': 0.10427724008741805, 'fraction_numerical': 0.0009366219169528567, 'mean_word_length': 2.9950124688279303, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4769629', 'n_tokens_mistral': 843, 'n_tokens_neox': 848, 'n_words': 182}