mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user