Refactor Enter/Leave listener accumulation#18405
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
da1a743 to
f61c832
Compare
|
Let’s wait a bit before we figure out the bug in the recent event commit. Caught it after a sync. |
e6ea83a to
b6267f4
Compare
Remove and move around code fix fix
| // EventPropagator.js, as they deviated from ReactDOM's newer | ||
| // implementations. | ||
|
|
||
| function getParent(inst) { |
There was a problem hiding this comment.
I get that this is 'legacy', but it's weird that fibers are called instances here (since we use that word for something else elsewhere.
could you explain why this other traversal fns are inlined multiple times instead of in one module? Also why do some of them have types, and some don't?
There was a problem hiding this comment.
They're inlined because we don't want them in ReactDOM anymore and by pulling them out, it means we won't accidently break another module by changing something else. They're essentially legacy, and in a bunch of the cases, will likely be killed when their associated module drops them. Some have types because the module is Flow types, whilst before they came from a module that wasn't Flow typed.
We already cleaned up and refactored two phase event accumulation in a previous PR, this PR cleans up and refactors the Enter/Leave logic so it's easier to follow and adapt for future work where we can refactor how events are accumulated and ties to synthetic events. This should also have a slight runtime performance win as we don't accumulate as many objects with this implementation.
I also inlined all the rest of the logic into RN and ResponderPlugin, as we no longer need a bunch of code for ReactDOM.