mirror of
https://github.com/facebook/react.git
synced 2026-02-26 07:55:55 +00:00
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.