Skip to content

perf(component drawer): optimize rendering the drawer content #9217

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

Merged
merged 17 commits into from
Oct 1, 2024

Conversation

luvkapur
Copy link
Member

@luvkapur luvkapur commented Sep 26, 2024

This PR optimizes the rendering of the component drawer by correctly memoizing the data it needs to render. It also extracts the components that depend on data accessed via hooks to their own standalone pure functional components instead of being class methods, which impacts performance and unnecessary re rendering.
It updates the component tree to not invoke the useLanes hook from each of its node. Instead it passes down the lanes hook data from the drawer to each of its children node via a local context wrapped at the root of the tree - this drastically reduces the amount of unnecessary calls to the hook, resulting in nodes being rendered 10x faster when there are a lot of lanes and components (Previously, it would take ~400ms to render each node when its state changed; open/close -> with this change it takes about ~40-45ms for each render)

@luvkapur luvkapur enabled auto-merge (squash) October 1, 2024 20:54
@luvkapur luvkapur merged commit cd136db into master Oct 1, 2024
11 checks passed
@luvkapur luvkapur deleted the perf-comp-drawer branch October 1, 2024 21:57
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