Mark FPS listener in ScrollViews as final, avoid reset in initView (#56609)#56609
Closed
Abbondanzo wants to merge 1 commit into
Closed
Mark FPS listener in ScrollViews as final, avoid reset in initView (#56609)#56609Abbondanzo wants to merge 1 commit into
Abbondanzo wants to merge 1 commit into
Conversation
|
@Abbondanzo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D102359747. |
…eact#56609) Summary: `mFpsListener` is injected via `ReactHorizontalScrollView`'s constructor and should live for the lifetime of the view. However, it was declared as a mutable field and nulled in `initView()`, which is called both during construction and when the view is recycled in a virtualized list. After recycling, `isScrollPerfLoggingEnabled()` returned false because `mFpsListener` was null, silently disabling FPS performance tracking for the rest of that view instance's lifecycle. The fix moves `mFpsListener` to a `final` field initialized in the constructor, and removes the `mFpsListener = null` assignment from `initView()`. Applied to `ReactScrollView`, `ReactHorizontalScrollView`, and `ReactNestedScrollView`. This is a safe change because both view managers are instantiated with a single instance of FPS listener, so recycled view instances will always reference the same FPS listener instance. Changelog: [Android][Fixed] - Fix FPS performance listener being cleared on ScrollView recycle Reviewed By: jehartzog Differential Revision: D102359747
ef4e88d to
92bbabb
Compare
|
This pull request has been merged in 59ac1db. |
Collaborator
|
This pull request was successfully merged by @Abbondanzo in 59ac1db When will my fix make it into a release? | How to file a pick request? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
mFpsListeneris injected viaReactHorizontalScrollView's constructor and should live for the lifetime of the view. However, it was declared as a mutable field and nulled ininitView(), which is called both during construction and when the view is recycled in a virtualized list. After recycling,isScrollPerfLoggingEnabled()returned false becausemFpsListenerwas null, silently disabling FPS performance tracking for the rest of that view instance's lifecycle.The fix moves
mFpsListenerto afinalfield initialized in the constructor, and removes themFpsListener = nullassignment frominitView(). Applied toReactScrollView,ReactHorizontalScrollView, andReactNestedScrollView.This is a safe change because both view managers are instantiated with a single instance of FPS listener, so recycled view instances will always reference the same FPS listener instance.
Changelog:
[Android][Fixed] - Fix FPS performance listener being cleared on ScrollView recycle
Reviewed By: jehartzog
Differential Revision: D102359747