Repository navigation
Conversation
|
Hi @smg99! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Summary
React DOM clears and restores
nameand rewritestypewhen updating an input. This sequencing matters for radio groups. In a large form of named text inputs, it also causes three attribute mutations per input even when both attributes already match.Skip these writes for ordinary inputs with an explicit
type="text"and a matching string name. Keep value synchronization and the existing update order for radio inputs, mismatched attributes, customized inputs, and object values that can run code during coercion.Adds a regression test that updates a controlled value and checks for zero
nameortypemutations. The test sees three mutations on unmodifiedmain.Addresses the named text input case in #36229. The broader approach in #36240 informed the scope of this change.
How did you test this change?
git diff --checkon the two changed files.cb7c59eand this patch in Chrome 157 on macOS. The benchmark synchronously re-renders the form and changes only the first controlled value. Each median covers 18 samples of 15 updates after warm-up.The 5,000-input case went from 15,000
nameandtypewrites to zero per update. Browser checks also covered uppercase radio types, customized input attribute callbacks, value coercion, and restoration of a changed name or type.