Skip to content
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

avoid updating om.next/queries unnecessarily when unmounting #638

Merged
merged 1 commit into from
Mar 6, 2016

Conversation

jlongster
Copy link
Contributor

I have a performance-sensitive component that renders a large list of items, and it only shows a subset of items in the actual DOM to fill the view. This subset is updated as you scroll to make it appear that everything is loaded in the DOM, when it's actually not.

I noticed that when items outside the view are removed from the DOM (after scrolling), a reconcile! and rerender would happen. This happens because the state was being modified in componentWillUnmount, but we don't need to modify that state if om.next/queries does not have the component instance in it. This optimization avoids unnecessary rerenders, and more importantly unnecessary query execution (modifying the state triggers both).

swannodette added a commit that referenced this pull request Mar 6, 2016
avoid updating om.next/queries unnecessarily when unmounting
@swannodette swannodette merged commit cb8757b into omcljs:master Mar 6, 2016
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.

2 participants