Skip to content

Commit

Permalink
Remove old reference to inst._wrapperState (#12987)
Browse files Browse the repository at this point in the history
This commit removes a reference to inst._wrapperState, which was the
old way of tracking input state in the stack renderer.

This means we no longer need to pass the instance into the associated
function, allowing us to eliminate an exception for IE (and a TODO).
  • Loading branch information
nhunzaker authored and gaearon committed Jun 11, 2018
1 parent c78957e commit d0d4280
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions packages/react-dom/src/events/ChangeEventPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,8 @@ function getTargetInstForInputOrChangeEvent(topLevelType, targetInst) {
}
}

function handleControlledInputBlur(inst, node) {
// TODO: In IE, inst is occasionally null. Why?
if (inst == null) {
return;
}

// Fiber and ReactDOM keep wrapper state in separate places
let state = inst._wrapperState || node._wrapperState;
function handleControlledInputBlur(node) {
let state = node._wrapperState;

if (!state || !state.controlled || node.type !== 'number') {
return;
Expand Down Expand Up @@ -303,7 +297,7 @@ const ChangeEventPlugin = {

// When blurring, set the value attribute for number inputs
if (topLevelType === TOP_BLUR) {
handleControlledInputBlur(targetInst, targetNode);
handleControlledInputBlur(targetNode);
}
},
};
Expand Down

0 comments on commit d0d4280

Please sign in to comment.