From e6583f3243a1b0379c89ef39fe28d0d779909d32 Mon Sep 17 00:00:00 2001 From: davidmarkclements Date: Wed, 23 Dec 2015 21:36:48 +0000 Subject: [PATCH] infinite recursion fix --- src/ReactBlessedComponent.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ReactBlessedComponent.js b/src/ReactBlessedComponent.js index d705716..08e8c47 100644 --- a/src/ReactBlessedComponent.js +++ b/src/ReactBlessedComponent.js @@ -26,6 +26,7 @@ const CONTENT_TYPES = {string: true, number: true}; export default class ReactBlessedComponent { constructor(tag) { this._tag = tag.toLowerCase(); + this._updating = false; this._renderedChildren = null; this._previousStyle = null; this._previousStyleCopy = null; @@ -40,6 +41,8 @@ export default class ReactBlessedComponent { // Setting some properties this._currentElement = element; this._eventListener = (type, ...args) => { + if (this._updating) return; + const handler = this._currentElement.props['on' + startCase(type).replace(/ /g, '')]; if (typeof handler === 'function') @@ -131,7 +134,9 @@ export default class ReactBlessedComponent { const {props: {children, ...options}} = nextElement, node = ReactBlessedIDOperations.get(this._rootNodeID); + this._updating = true; update(node, solveClass(options)); + this._updating = false; // Updating children const childrenToUse = children === null ? [] : [].concat(children);