@samitouri / QOS-React / commits / c8d877a4c4

Remove rootNodeID

We only use this to determine if something is mounted or not but I don't think we really need to.

Sebastian Markbage committed Nov 15, 2016 at 17:44 UTC c8d877a4c47211bf141a5ed0e2c75f626e68b45b
4 files changed +8 -22
src/renderers/dom/fiber/ReactDOMFiberComponent.js
-5
@@ -351,7 +351,6 @@ function trapBubbledEventsLocal() {
351 var inst = this;
352 // If a component renders to null or if another component fatals and causes
353 // the state of the tree to be corrupted, `node` here can be null.
354 - invariant(inst._rootNodeID, 'Must be mounted to trap events');
354 var node = getNode(inst);
355 invariant(
356 node,
@@ -736,8 +735,6 @@ function updateDOMChildren(workInProgress, lastProps, nextProps, transaction, co
735 }
736 }
737
739 -var globalIdCounter = 1;
740 -
738 var ReactDOMFiberComponent = {
739
740
@@ -763,7 +760,6 @@ var ReactDOMFiberComponent = {
760 // workInProgress._tag = tag.toLowerCase();
761 // setAndValidateContentChildDev.call(workInProgress, null);
762
766 - workInProgress._rootNodeID = globalIdCounter++;
763 workInProgress._domID = hostContainerInfo._idCounter++;
764 workInProgress._hostParent = hostParent;
765 workInProgress._hostContainerInfo = hostContainerInfo;
@@ -1089,7 +1085,6 @@ var ReactDOMFiberComponent = {
1085 workInProgress.unmountChildren(safely, skipLifecycle);
1086 ReactDOMComponentTree.uncacheNode(workInProgress);
1087 EventPluginHub.deleteAllListeners(workInProgress);
1092 - workInProgress._rootNodeID = 0;
1088 workInProgress._domID = 0;
1089 workInProgress._wrapperState = null;
1090
src/renderers/dom/fiber/wrappers/ReactDOMFiberInput.js
+2 -7
@@ -256,10 +256,7 @@ var ReactDOMInput = {
256 },
257
258 restoreControlledState: function(inst) {
259 - if (inst._rootNodeID) {
260 - // DOM component is still mounted; update
261 - ReactDOMInput.updateWrapper(inst);
262 - }
259 + ReactDOMInput.updateWrapper(inst);
260 var props = inst._currentElement.props;
261 updateNamedCousins(inst, props);
262 },
@@ -304,9 +301,7 @@ function updateNamedCousins(thisInstance, props) {
301 // If this is a controlled radio button group, forcing the input that
302 // was previously checked to update will cause it to be come re-checked
303 // as appropriate.
307 - if (otherInstance._rootNodeID) {
308 - ReactDOMInput.updateWrapper(otherInstance);
309 - }
304 + ReactDOMInput.updateWrapper(otherInstance);
305 }
306 }
307 }
src/renderers/dom/fiber/wrappers/ReactDOMFiberSelect.js
+4 -6
@@ -187,13 +187,11 @@ var ReactDOMSelect = {
187 },
188
189 restoreControlledState: function(inst) {
190 - if (inst._rootNodeID) {
191 - var props = inst._currentElement.props;
192 - var value = props.value;
190 + var props = inst._currentElement.props;
191 + var value = props.value;
192
194 - if (value != null) {
195 - updateOptions(inst, Boolean(props.multiple), value);
196 - }
193 + if (value != null) {
194 + updateOptions(inst, Boolean(props.multiple), value);
195 }
196 },
197 };
src/renderers/dom/fiber/wrappers/ReactDOMFiberTextarea.js
+2 -4
@@ -162,10 +162,8 @@ var ReactDOMTextarea = {
162 },
163
164 restoreControlledState: function(inst) {
165 - if (inst._rootNodeID) {
166 - // DOM component is still mounted; update
167 - ReactDOMTextarea.updateWrapper(inst);
168 - }
165 + // DOM component is still mounted; update
166 + ReactDOMTextarea.updateWrapper(inst);
167 },
168
169 };