Repository navigation
Conversation
79342bc to
5ff88c0
Compare
6f272fa to
78d8d80
Compare
chrfalch
left a comment
There was a problem hiding this comment.
The change keeps dispatch behavior the same: the prop names are fixed for the whole dispatch, each target still reads its current props, and the timestamp, direct-event and composed-path changes match the old results (composedPath() still returns a copy, so the frozen empty array never reaches user code). The two comments below are about clarity, not correctness. The test plan lists Fantom and Prettier but not yarn flow-check. Please add it, because the event init object now uses a computed symbol key in place of setEventInitTimeStamp, and ReactNativeElement adds a new $FlowExpectedError suppression.
Native event dispatch reads the same handler prop name from the event at each target. Read the capture and bubble prop names once before traversing the path, and pass the name for each phase to the declarative listener lookup of each target. The lookup takes the name only from its caller, and uses the event type mapping when the event carries no name, as for events dispatched from JavaScript. Each target still reads its current props when invoking listeners. Set the native timestamp in the event initializer and reuse a frozen empty path before and after dispatch. `yarn fantom` passes for the suites under `src/private/renderer` and `src/private/webapis/dom`, including `EventDispatching-itest.js`, `EventTargetDispatching-itest.js`, `EventTarget-itest.js` and `Event-itest.js`. These suites cover capture, bubbling, propagation stops, listener errors and custom timestamps. A new case in `EventTargetDispatching-itest.js` dispatches an event from JavaScript and checks that the handler props along the path run in capture and bubble order; it fails when the lookup does not fall back to the event type mapping. `yarn flow-check`, `yarn lint` and `yarn test` for the touched directories pass, and the changed files pass Prettier. A Fantom benchmark dispatches pointer-up events with Hermes on a stable tree of 20 levels, in an optimized Fantom tester build on Apple M6. For batches of 5,000 dispatches, the median falls from 1,353,503 to 1,076,197 retired instructions per event. Both versions make the same number of handler calls. Signed-off-by: James Ide <ide@expo.dev>
78d8d80 to
dab62a9
Compare
|
Thanks for the review. The test plan now lists |
Summary:
Native event dispatch reads the same handler prop name from the event at each target. Read the capture and bubble prop names once before traversing the path, and pass the name for each phase to the declarative listener lookup of each target. The lookup takes the name only from its caller, and uses the event type mapping when the event carries no name, as for events dispatched from JavaScript. Each target still reads its current props when invoking listeners.
Set the native timestamp in the event initializer and reuse a frozen empty path before and after dispatch.
Changelog:
[INTERNAL] [CHANGED] - Reuse handler prop names during Fabric event dispatch.
Test Plan:
yarn fantompasses for the suites undersrc/private/rendererandsrc/private/webapis/dom, includingEventDispatching-itest.js,EventTargetDispatching-itest.js,EventTarget-itest.jsandEvent-itest.js. These suites cover capture, bubbling, propagation stops, listener errors and custom timestamps. A new case inEventTargetDispatching-itest.jsdispatches an event from JavaScript and checks that the handler props along the path run in capture and bubble order; it fails when the lookup does not fall back to the event type mapping.yarn flow-check,yarn lintandyarn testfor the touched directories pass, and the changed files pass Prettier.A Fantom benchmark dispatches pointer-up events with Hermes on a stable tree of 20 levels, in an optimized Fantom tester build on Apple M6. For batches of 5,000 dispatches, the median falls from 1,353,503 to 1,076,197 retired instructions per event. Both versions make the same number of handler calls.