Skip to content

Commit

Permalink
Track inputs after setting its properties
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sebmarkbage committed Nov 23, 2016
1 parent 075f304 commit 9ceed8d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 0 additions & 3 deletions scripts/fiber/tests-failing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ src/renderers/dom/shared/__tests__/ReactEventIndependence-test.js
src/renderers/dom/shared/__tests__/ReactEventListener-test.js
* should batch between handlers from different roots

src/renderers/dom/shared/eventPlugins/__tests__/ChangeEventPlugin-test.js
* should not fire change when setting checked programmatically

src/renderers/dom/shared/eventPlugins/__tests__/SimpleEventPlugin-test.js
* should forward clicks when it becomes not disabled
* should not forward clicks when it becomes disabled
Expand Down
1 change: 1 addition & 0 deletions scripts/fiber/tests-passing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ src/renderers/dom/shared/eventPlugins/__tests__/ChangeEventPlugin-test.js
* should fire change for checkbox input
* should catch setting the value programmatically
* should not fire change when setting the value programmatically
* should not fire change when setting checked programmatically
* should unmount
* should only fire change for checked radio button once
* should deduplicate input value change events
Expand Down
10 changes: 6 additions & 4 deletions src/renderers/dom/fiber/ReactDOMFiberComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,6 @@ var ReactDOMFiberComponent = {
case 'input':
ReactDOMFiberInput.mountWrapper(domElement, rawProps);
props = ReactDOMFiberInput.getHostProps(domElement, rawProps);
// TODO: Make sure we check if this is still unmounted or do any clean
// up necessary since we never stop tracking anymore.
inputValueTracking.trackNode((domElement : any));
trapBubbledEventsLocal(domElement, tag);
// For controlled components we always need to ensure we're listening
// to onChange. Even if there is no listener.
Expand All @@ -575,7 +572,6 @@ var ReactDOMFiberComponent = {
case 'textarea':
ReactDOMFiberTextarea.mountWrapper(domElement, rawProps);
props = ReactDOMFiberTextarea.getHostProps(domElement, rawProps);
inputValueTracking.trackNode((domElement : any));
trapBubbledEventsLocal(domElement, tag);
// For controlled components we always need to ensure we're listening
// to onChange. Even if there is no listener.
Expand All @@ -600,12 +596,18 @@ var ReactDOMFiberComponent = {
// DOM yet. We need a special effect to handle this.
switch (tag) {
case 'input':
// TODO: Make sure we check if this is still unmounted or do any clean
// up necessary since we never stop tracking anymore.
inputValueTracking.trackNode((domElement : any));
ReactDOMFiberInput.postMountWrapper(domElement, rawProps);
if (props.autoFocus) {
focusNode(domElement);
}
break;
case 'textarea':
// TODO: Make sure we check if this is still unmounted or do any clean
// up necessary since we never stop tracking anymore.
inputValueTracking.trackNode((domElement : any));
ReactDOMFiberTextarea.postMountWrapper(domElement, rawProps);
if (props.autoFocus) {
focusNode(domElement);
Expand Down

0 comments on commit 9ceed8d

Please sign in to comment.