dillon1000/react
Commit
Browse files Handle nested controlled events (#8251)
I came up with a contrived case of where nested controlled events could fire within the same batch - but on different targets. I think we came to the conclusion that controlled values typically cannot use preventDefault so it is ok that they don't flush until after the event has finished. So therefore we accumulate a queue of all the nested targets within a batch and then restore state on all of them. I'm still skeptical that this is the correct way to do controlled values. The reason we have to do them in a single event loop is because when you type, the sequence of values that get accepted or not can matter. I wonder if there is a scenario we can come up with where you can fire multiple inner events in an event loop and end up with batching causing problems. This effectively just reimplements asap again but with no allocations for a single target and no closure allocations.
Changed paths7 files
First-parent comparisonscripts/fiber/tests-failing.txt ModifiedM src/renderers/dom/shared/ReactEventListener.js ModifiedM src/renderers/dom/shared/eventPlugins/ChangeEventPlugin.js ModifiedM src/renderers/dom/shared/wrappers/__tests__/ReactDOMInput-test.js ModifiedM src/renderers/shared/shared/event/ReactControlledComponent.js ModifiedM src/renderers/shared/shared/event/ReactGenericBatching.js ModifiedM src/test/ReactTestUtils.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…