Skip to content

Commit

Permalink
Merge pull request #38 from davidmarkclements/patch-3
Browse files Browse the repository at this point in the history
infinite recursion fix
  • Loading branch information
Yomguithereal committed Feb 10, 2016
2 parents 1449f07 + e6583f3 commit 8dce749
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ReactBlessedComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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') {
Expand Down Expand Up @@ -135,7 +138,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);
Expand Down

0 comments on commit 8dce749

Please sign in to comment.