@samitouri / QOS-React-2 / commits / c54900f63e
Fork 0

The library for web and native user interfaces.

Fix Composition Level of Components w/o Owners

This fixes a bug with components constructed with no owners, for example: // Both the <div> and <span> have no owners. React.renderComponent(<div><span /></div>, node); They should have a composition level of 1 and their keys should be prefixed with 0 to indicate they were created without owners. However, they currently incorrectly get a composition level of 0 (which means that //their// children will have keys prefixed with 0, which is wrong).

CommitSyncScript committed Jun 28, 2013 at 13:46 UTC c54900f63e3841c571e637b364efd53f9af3c9c9
1 file changed +1 -2
src/core/ReactCompositeComponent.js
+1 -2
@@ -476,8 +476,7 @@ var ReactCompositeComponentMixin = {
476 this.state = null;
477 this._pendingState = null;
478 this._compositeLifeCycleState = null;
479 - this._compositionLevel = ReactCurrentOwner.current ?
480 - ReactCurrentOwner.getDepth() + 1 : 0;
479 + this._compositionLevel = ReactCurrentOwner.getDepth() + 1;
480 },
481
482 /**