<commit_before>///
// Dependencies
///

import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';

import * as actions from './actions';


///
// View
///

class ManagedHiddenFormControlView extends Component {
	static contextTypes = {
		formName: PropTypes.string.isRequired,
	};


	///
	// Hooks
	///

	componentWillMount() {
		this.updateValue(this.props.value);
	}

	componentWillReceiveProps(nextProps) {
		if(this.props.value !== nextProps.value) {
			this.updateValue(nextProps.value);
		}
	}


	///
	// Methods
	///

	updateValue(value) {
		const formName = this.context.formName;
		const fieldName = this.props.name;

		this.props.fieldChanged(formName, fieldName, value);
	}

	getStateValue() {
		const keyPath = [
			this.context.formName, 'auxValues', this.props.name
		];
		return this.props.forms.getIn(keyPath, '');
	}


	///
	// Rendering
	///

	render() {
		return (
			<input
				type="hidden" 
				value={this.getStateValue()}
			/>
		);
	}
}


///
// Container
///

function mapStateToProps(state) {
	return {
		forms: state.get('forms'),
	};
}

function mapDispatchToProps(dispatch) {<commit_msg>Refactored: Moved static property outside of class declaration<commit_after>///
// Dependencies
///

import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';

import * as actions from './actions';


///
// View
///

class ManagedHiddenFormControlView extends Component {
	///
	// Hooks
	///

	componentWillMount() {
		this.updateValue(this.props.value);
	}

	componentWillReceiveProps(nextProps) {
		if(this.props.value !== nextProps.value) {
			this.updateValue(nextProps.value);
		}
	}


	///
	// Methods
	///

	updateValue(value) {
		const formName = this.context.formName;
		const fieldName = this.props.name;

		this.props.fieldChanged(formName, fieldName, value);
	}

	getStateValue() {
		const keyPath = [
			this.context.formName, 'auxValues', this.props.name
		];
		return this.props.forms.getIn(keyPath, '');
	}


	///
	// Rendering
	///

	render() {
		return (
			<input
				type="hidden" 
				value={this.getStateValue()}
			/>
		);
	}
}

ManagedHiddenFormControlView.contextTypes = {
	formName: PropTypes.string.isRequired,
};


///
// Container
///

function mapStateToProps(state) {
	return {
		forms: state.get('forms'),
	};
}

function mapDispatchToProps(dispatch) {
{'fraction_non_alphanumeric': 0.16040523427606584, 'fraction_numerical': 0.0, 'mean_word_length': 3.1003460207612457, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6846905', 'n_tokens_mistral': 885, 'n_tokens_neox': 803, 'n_words': 138}