<commit_before>import Lifecycle from './../DOM/lifecycle';
import { isNullOrUndef, NO_OP, throwError, isFunction } from '../shared';
import { createVPlaceholder } from './../core/shapes';

const noOp = 'Inferno Error: Can only update a mounted or mounting component. This usually means you called setState() or forceUpdate() on an unmounted component. This is a no-op.';
const componentCallbackQueue = new Map();

function addToQueue(component, force, callback) {
	let queue = componentCallbackQueue.get(component);

	if (!queue) {
		queue = [];
		componentCallbackQueue.set(component, queue);
		requestAnimationFrame(() => {
			applyState(component, force, () => {
				for (let i = 0; i < queue.length; i++) {
					queue[i]();
				}
			});
			componentCallbackQueue.delete(component);
			component._processingSetState = false;
		});
	}
	if (callback) {
		queue.push(
			callback
		);
	}
}

// Copy of the util from dom/util, otherwise it makes massive bundles
function getActiveNode() {
	return document.activeElement;
}

// Copy of the util from dom/util, otherwise it makes massive bundles
function resetActiveNode(activeNode) {
	if (activeNode !== document.body && document.activeElement !== activeNode) {
		activeNode.focus(); // TODO: verify are we doing new focus event, if user has focus listener this might trigger it
	}
}

function queueStateChanges(component, newState, callback) {
	if (isFunction(newState)) {
		newState = newState();
	}
	for (let stateKey in newState) {
		component._pendingState[stateKey] = newState[stateKey];<commit_msg>added state passing to functional setState<commit_after>import Lifecycle from './../DOM/lifecycle';
import { isNullOrUndef, NO_OP, throwError, isFunction } from '../shared';
import { createVPlaceholder } from './../core/shapes';

const noOp = 'Inferno Error: Can only update a mounted or mounting component. This usually means you called setState() or forceUpdate() on an unmounted component. This is a no-op.';
const componentCallbackQueue = new Map();

function addToQueue(component, force, callback) {
	let queue = componentCallbackQueue.get(component);

	if (!queue) {
		queue = [];
		componentCallbackQueue.set(component, queue);
		requestAnimationFrame(() => {
			applyState(component, force, () => {
				for (let i = 0; i < queue.length; i++) {
					queue[i]();
				}
			});
			componentCallbackQueue.delete(component);
			component._processingSetState = false;
		});
	}
	if (callback) {
		queue.push(
			callback
		);
	}
}

// Copy of the util from dom/util, otherwise it makes massive bundles
function getActiveNode() {
	return document.activeElement;
}

// Copy of the util from dom/util, otherwise it makes massive bundles
function resetActiveNode(activeNode) {
	if (activeNode !== document.body && document.activeElement !== activeNode) {
		activeNode.focus(); // TODO: verify are we doing new focus event, if user has focus listener this might trigger it
	}
}

function queueStateChanges(component, newState, callback) {
	if (isFunction(newState)) {
		newState = newState(component.state);
	}
	for (let stateKey in newState) {
		component._pendingState[stateKey] = newState[stateKey];
{'fraction_non_alphanumeric': 0.12222222222222222, 'fraction_numerical': 0.0006349206349206349, 'mean_word_length': 4.386324786324787, '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': '7114588', 'n_tokens_mistral': 973, 'n_tokens_neox': 900, 'n_words': 290}