Skip to content

Commit 2f01751

Browse files
committed
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.
1 parent cee4ec8 commit 2f01751

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

scripts/fiber/tests-failing.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ src/renderers/dom/shared/__tests__/ReactEventIndependence-test.js
5555
src/renderers/dom/shared/__tests__/ReactEventListener-test.js
5656
* should batch between handlers from different roots
5757

58-
src/renderers/dom/shared/eventPlugins/__tests__/ChangeEventPlugin-test.js
59-
* should not fire change when setting checked programmatically
60-
6158
src/renderers/dom/shared/eventPlugins/__tests__/SimpleEventPlugin-test.js
6259
* should not forward clicks when it starts out disabled
6360
* should not forward clicks when it becomes disabled

scripts/fiber/tests-passing.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,7 @@ src/renderers/dom/shared/eventPlugins/__tests__/ChangeEventPlugin-test.js
679679
* should fire change for checkbox input
680680
* should catch setting the value programmatically
681681
* should not fire change when setting the value programmatically
682+
* should not fire change when setting checked programmatically
682683
* should unmount
683684
* should only fire change for checked radio button once
684685
* should deduplicate input value change events

src/renderers/dom/fiber/ReactDOMFiberComponent.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,9 +552,6 @@ var ReactDOMFiberComponent = {
552552
case 'input':
553553
ReactDOMFiberInput.mountWrapper(domElement, rawProps);
554554
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));
558555
trapBubbledEventsLocal(domElement, tag);
559556
// For controlled components we always need to ensure we're listening
560557
// to onChange. Even if there is no listener.
@@ -575,7 +572,6 @@ var ReactDOMFiberComponent = {
575572
case 'textarea':
576573
ReactDOMFiberTextarea.mountWrapper(domElement, rawProps);
577574
props = ReactDOMFiberTextarea.getHostProps(domElement, rawProps);
578-
inputValueTracking.trackNode((domElement : any));
579575
trapBubbledEventsLocal(domElement, tag);
580576
// For controlled components we always need to ensure we're listening
581577
// to onChange. Even if there is no listener.
@@ -600,12 +596,18 @@ var ReactDOMFiberComponent = {
600596
// DOM yet. We need a special effect to handle this.
601597
switch (tag) {
602598
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));
603602
ReactDOMFiberInput.postMountWrapper(domElement, rawProps);
604603
if (props.autoFocus) {
605604
focusNode(domElement);
606605
}
607606
break;
608607
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));
609611
ReactDOMFiberTextarea.postMountWrapper(domElement, rawProps);
610612
if (props.autoFocus) {
611613
focusNode(domElement);

0 commit comments

Comments
 (0)