Skip to content

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