dillon1000/react
Commit
Browse files Update tracked value after resetting radio group (#27394)
Fixes #26876, I think. Review each commit separately (all assertions pass in main already, except the last assertInputTrackingIsClean in "should control radio buttons"). I'm actually a little confused on two things here: * All the isCheckedDirty assertions are true. But I don't think we set .checked unconditionally? So how does this happen? * https://github.com/facebook/react/issues/26876#issuecomment-1611662862 claims that https://github.com/facebook/react/compare/d962f35ca...1f248bdd7 contains the faulty change, but it doesn't appear to change the restoration logic that I've touched here. (One difference outside restoration is that updateProperties did previously set `.checked` when `nextProp !== lastProp` whereas the new logic in updateInput is to set it when `node.checked !== !!checked`.) But it seems to me like we need this call here anyway, and if it fixes it then it fixes it? I think technically speaking we probably should do all the updateInput() calls and then all the updateValueIfChanged() calls—in particular I think if clicking A changed the checked radio button from B to C then the code as I have it would be incorrect, but that also seems unlikely so idk whether to care. cc @zhengjitf @Luk-z who did some investigation on the original issue
Changed paths2 files
First-parent comparisonpackages/react-dom-bindings/src/client/ReactDOMInput.js ModifiedM packages/react-dom/src/__tests__/ReactDOMInput-test.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…