@samitouri / QOS-React / commits / 61a1a50955

Split mountComponent into create and set initial properties

This lets us insert children in between these two steps.

Sebastian Markbage committed Nov 17, 2016 at 20:24 UTC 61a1a50955c1482aea8d7832f9252e74ff4f7469
1 file changed +20 -12
src/renderers/dom/fiber/ReactDOMFiberComponent.js
+20 -12
@@ -450,12 +450,11 @@ var ReactDOMFiberComponent = {
450 return tag === 'svg' || tag === 'foreignobject';
451 },
452
453 - mountComponent: function(
454 - internalInstanceHandle : Object,
453 + createElement: function(
454 tag : string,
456 - rootContainerElement : Element,
455 props : Object,
458 - context : Object
456 + rootContainerElement : Element,
457 + internalInstanceHandle : Object
458 ) : Element {
459 // TODO:
460 // validateDangerousTag(tag);
@@ -503,6 +502,19 @@ var ReactDOMFiberComponent = {
502 tag
503 );
504 }
505 +
506 + ReactDOMComponentTree.precacheFiberNode(internalInstanceHandle, domElement);
507 +
508 + return domElement;
509 + },
510 +
511 + setInitialProperties: function(
512 + domElement : Element,
513 + tag : string,
514 + props : Object,
515 + rootContainerElement : Element
516 + ) : void {
517 +
518 var isCustomComponentTag = isCustomComponent(tag, props);
519 if (__DEV__) {
520 if (isCustomComponentTag && !didWarnShadyDOM && domElement.shadyRoot) {
@@ -563,7 +575,6 @@ var ReactDOMFiberComponent = {
575
576 assertValidProps(tag, props);
577
566 - ReactDOMComponentTree.precacheFiberNode(internalInstanceHandle, domElement);
578 updateDOMProperties(
579 domElement,
580 rootContainerElement,
@@ -607,18 +618,15 @@ var ReactDOMFiberComponent = {
618 }
619 break;
620 }
610 -
611 - return domElement;
621 },
622
614 - receiveComponent: function(
623 + updateProperties(
624 domElement : Element,
616 - rootContainerElement : Element,
625 tag : string,
626 lastProps : Object,
627 nextProps : Object,
620 - context : Object
621 - ) {
628 + rootContainerElement : Element
629 + ) : void {
630 switch (tag) {
631 case 'input':
632 lastProps = ReactDOMFiberInput.getHostProps(domElement, lastProps);
@@ -674,7 +682,7 @@ var ReactDOMFiberComponent = {
682 }
683 },
684
677 - restoreControlledState: function(domElement : Element, tag : string, props : Object) {
685 + restoreControlledState(domElement : Element, tag : string, props : Object) : void {
686 switch (tag) {
687 case 'input':
688 ReactDOMFiberInput.restoreControlledState(domElement, props);