Skip to content

Commit

Permalink
cherry pick radio input fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Nov 16, 2017
1 parent 571a920 commit 4c75c5b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/renderers/dom/client/wrappers/ReactDOMInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var DOMPropertyOperations = require('DOMPropertyOperations');
var LinkedValueUtils = require('LinkedValueUtils');
var ReactDOMComponentTree = require('ReactDOMComponentTree');
var ReactUpdates = require('ReactUpdates');

var inputValueTracking = require('inputValueTracking');
var invariant = require('invariant');
var warning = require('warning');

Expand Down Expand Up @@ -348,6 +348,11 @@ function _handleChange(event) {
'ReactDOMInput: Mixing React and non-React radio inputs with the ' +
'same `name` is not supported.',
);

// We need update the tracked value on the named cousin since the value
// was changed but the input saw no event or value set
inputValueTracking.updateValueIfChanged(otherNode);

// If this is a controlled radio button group, forcing the input that
// was previously checked to update will cause it to be come re-checked
// as appropriate.
Expand Down
4 changes: 0 additions & 4 deletions src/renderers/dom/shared/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -907,10 +907,6 @@ ReactDOMComponent.Mixin = {
// happen after `_updateDOMProperties`. Otherwise HTML5 input validations
// raise warnings and prevent the new value from being assigned.
ReactDOMInput.updateWrapper(this);

// We also check that we haven't missed a value update, such as a
// Radio group shifting the checked value to another named radio input.
inputValueTracking.updateValueIfChanged(this);
break;
case 'textarea':
ReactDOMTextarea.updateWrapper(this);
Expand Down

0 comments on commit 4c75c5b

Please sign in to comment.