-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Fix Shortcut EventEmitter Leak/Re-render leaks #31779
Conversation
Pinging @elastic/kibana-canvas |
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic PR, brings the direct manipulation interaction speed to 30-60FPS with a dozen or two elements, all interactions still work and nice extractions too!
# Conflicts: # yarn.lock
# Conflicts: # yarn.lock
# Conflicts: # yarn.lock
# Conflicts: # yarn.lock
Thanks @monfera ... I had a nasty case of the flu Friday and lost track of this guy. You rock. |
Summary
We were seeing EventEmitter leaks involving
Shortcuts
, and my analysis of unnecessary re-renders showedShortcuts
was repainting excessively, (more than 300 times on Workpad load).I discovered this is due to the
Shortcuts
element being rendered on every page of the workpad... I added a check to be sure the page was active, and that solved theventEmitter
problem.I then extracted out the logic into a standalone component and created bound functions in that component to prevent unnecessary repaint. Since the
selectedElements
andselectedElementIds
are being recreated with each aeroelastic change, I also added a fast-check of the props in the newWorkpadShortcuts
component to prevent repaints.In all, this change fixes the steady increase in listeners being attached and GC'd, and drastically improves re-render on the main thread.
Listeners being created and GC'd, before, 365-391:
After, 16-130: