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

Optimize node selector panel and use group hover #2625

Conversation

RunDevelopment
Copy link
Member

Changes:

  • Use useMemo for the JSX tree inside RepresentativeNodeWrapper and RepresentativeNode. While these components are already memoed, memo is ineffective when one of the used contexts updates. Even if the updated context values do not lead to any changes in the DOM, React still has to re-create and diff the JSX tree of the component. useMemo not only caches the tree, it also allows React to immediately see that the cache tree didn't change (since they are the same object).
  • I removed 3 instances of using useState to track whether a component is hovered, and replaced them with _groupHover. This makes the hover effects instant (because we don't need to re-render anything) and means that hover effects can't get stuck.

Copy link
Member

@joeyballentine joeyballentine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

@joeyballentine joeyballentine merged commit f283ad5 into chaiNNer-org:main Feb 28, 2024
4 checks passed
@RunDevelopment RunDevelopment deleted the optimize-node-selector-and-hover branch February 28, 2024 18:40
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.

None yet

2 participants