@samitouri / QOS-React / commits / 9ceed8d69b

Track inputs after setting its properties

This used to be done at the end of the transaction but I made it synchronous. For this to work it needs to be applied after we have already set the .type property since it is read by inputValueTracker.

Sebastian Markbage committed Nov 20, 2016 at 19:00 UTC 9ceed8d69b04b0ea37d4323c54aad176b2ad0e8a
3 files changed +7 -7
scripts/fiber/tests-failing.txt
-3
@@ -50,9 +50,6 @@ src/renderers/dom/shared/__tests__/ReactEventIndependence-test.js
50 src/renderers/dom/shared/__tests__/ReactEventListener-test.js
51 * should batch between handlers from different roots
52
53 -src/renderers/dom/shared/eventPlugins/__tests__/ChangeEventPlugin-test.js
54 -* should not fire change when setting checked programmatically
55 -
53 src/renderers/dom/shared/eventPlugins/__tests__/SimpleEventPlugin-test.js
54 * should forward clicks when it becomes not disabled
55 * should not forward clicks when it becomes disabled
scripts/fiber/tests-passing.txt
+1
@@ -686,6 +686,7 @@ src/renderers/dom/shared/eventPlugins/__tests__/ChangeEventPlugin-test.js
686 * should fire change for checkbox input
687 * should catch setting the value programmatically
688 * should not fire change when setting the value programmatically
689 +* should not fire change when setting checked programmatically
690 * should unmount
691 * should only fire change for checked radio button once
692 * should deduplicate input value change events
src/renderers/dom/fiber/ReactDOMFiberComponent.js
+6 -4
@@ -552,9 +552,6 @@ var ReactDOMFiberComponent = {
552 case 'input':
553 ReactDOMFiberInput.mountWrapper(domElement, rawProps);
554 props = ReactDOMFiberInput.getHostProps(domElement, rawProps);
555 - // TODO: Make sure we check if this is still unmounted or do any clean
556 - // up necessary since we never stop tracking anymore.
557 - inputValueTracking.trackNode((domElement : any));
555 trapBubbledEventsLocal(domElement, tag);
556 // For controlled components we always need to ensure we're listening
557 // to onChange. Even if there is no listener.
@@ -575,7 +572,6 @@ var ReactDOMFiberComponent = {
572 case 'textarea':
573 ReactDOMFiberTextarea.mountWrapper(domElement, rawProps);
574 props = ReactDOMFiberTextarea.getHostProps(domElement, rawProps);
578 - inputValueTracking.trackNode((domElement : any));
575 trapBubbledEventsLocal(domElement, tag);
576 // For controlled components we always need to ensure we're listening
577 // to onChange. Even if there is no listener.
@@ -600,12 +596,18 @@ var ReactDOMFiberComponent = {
596 // DOM yet. We need a special effect to handle this.
597 switch (tag) {
598 case 'input':
599 + // TODO: Make sure we check if this is still unmounted or do any clean
600 + // up necessary since we never stop tracking anymore.
601 + inputValueTracking.trackNode((domElement : any));
602 ReactDOMFiberInput.postMountWrapper(domElement, rawProps);
603 if (props.autoFocus) {
604 focusNode(domElement);
605 }
606 break;
607 case 'textarea':
608 + // TODO: Make sure we check if this is still unmounted or do any clean
609 + // up necessary since we never stop tracking anymore.
610 + inputValueTracking.trackNode((domElement : any));
611 ReactDOMFiberTextarea.postMountWrapper(domElement, rawProps);
612 if (props.autoFocus) {
613 focusNode(domElement);