Skip to content

Add useStaticScrollParent #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lilyvelour
Copy link

Hey there!

Our team is currently using react-list for a project. In the process of doing some performance fixes, I noticed an unusually large chunk of time being spent in scroll events, even with a very simple item render function. Digging deeper through some performance profiling in our app, I found that a large amount of this time was spent calculating styles - specifically, window.getComputedStyle (about 70-80% of the frame).

Our app has a decently large tree between the list component and the scroll parent, with quite a few styles applied. While we could probably resolve this by using the scrollParentGetter and caching the result ourselves, allowing an option to cache the scroll parent in the component saves a lot of duplicated logic, and design-wise didn't seem too far from the norm. In addition, the current implementation could be used in conjunction with scrollParentGetter, and that function would be invoked only once, with the result cached during the component's lifetime.

The option is disabled by default to maintain backwards compatibility.

Let me know if this would be useful, happy to discuss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant