Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Android: Update coalesce to prefer newest event
Summary: The only callsite of `coalesce` looks like this: ``` newEvent.coalesce(oldEvent); ``` The default `coalesce` implementation returns the event with the most recent timestamp. When the events have the same timestamp then, using the variable names from above, `coalesce` returns `oldEvent`. This change updates `coalesce`'s implementation to make it explicit that it returns `this` (`newEvent` in the variable names from above) in the case of a tie. The motivation for this change is related to scroll events. In my team's app, we were seeing scroll events being emitted with the same timestamp and the coalescing logic was causing the oldest scroll event to be chosen. This was causing our JavaScript code to receive stale scroll information and the way the JavaScript code utilized this stale scroll information resulted in the ScrollView settling on the wrong scroll position. **Test plan (required)** Verified that scroll events work properly in a ScrollView in a test app. Also, my team's app uses this Closes #11080 Differential Revision: D4226152 Pulled By: andreicoman11 fbshipit-source-id: d28a2569225ca95de662f2239a0fa14de0540a7d
- Loading branch information