<commit_before>/*globals require: false, module: false */
'use strict';
var React = require('react');
// XXX move ColumnEdit2 to views?
var ColumnEdit = require('../ColumnEdit2');
var Button = require('react-bootstrap/lib/Button');
var Tooltip = require('react-bootstrap/lib/Tooltip');
var OverlayTrigger = require('react-bootstrap/lib/OverlayTrigger');

function addColumnAddButton(Component) {
	return React.createClass({
		displayName: 'SpreadsheetColumnAdd',
		getInitialState() {
			return {
				openColumnEdit: !this.props.appState.cohort[0] && !this.props.appState.loadPending,
			};
		},
		componentWillReceiveProps: function(newProps) {
			if (!this.state.openColumnEdit && !newProps.appState.cohort[0]) {
				this.setState({openColumnEdit: true});
			}
		},
		onShow() {
			this.setState({openColumnEdit: true});
		},
		onHide() {
			this.setState({openColumnEdit: false});<commit_msg>Prevent race on closing column add dialog.<commit_after>/*globals require: false, module: false */
'use strict';
var React = require('react');
// XXX move ColumnEdit2 to views?
var ColumnEdit = require('../ColumnEdit2');
var Button = require('react-bootstrap/lib/Button');
var Tooltip = require('react-bootstrap/lib/Tooltip');
var OverlayTrigger = require('react-bootstrap/lib/OverlayTrigger');

function addColumnAddButton(Component) {
	return React.createClass({
		displayName: 'SpreadsheetColumnAdd',
		getInitialState() {
			return {
				openColumnEdit: !this.props.appState.cohort[0] && !this.props.appState.loadPending,
			};
		},
		componentWillReceiveProps: function(newProps) {
			// If we had a cohort but lost it (e.g. due to change in servers),
			// and the columnEdit is closed: open it.
			if (!this.state.openColumnEdit &&
				this.props.appState.cohort[0] &&
				!newProps.appState.cohort[0]) {

				this.setState({openColumnEdit: true});
			}
		},
		onShow() {
			this.setState({openColumnEdit: true});
		},
		onHide() {
			this.setState({openColumnEdit: false});
{'fraction_non_alphanumeric': 0.15030364372469635, 'fraction_numerical': 0.004554655870445344, 'mean_word_length': 4.681034482758621, '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': '5806638', 'n_tokens_mistral': 680, 'n_tokens_neox': 619, 'n_words': 129}