You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've found a memory leak in the Shortcuts class. When you remove the shortcut for an element you don't check if the element's shortcuts are empty and left the element in the registeredShortcuts map (with an empty array):
Editor.js Version
v2.29.0
Issue description
Hi!
I've found a memory leak in the Shortcuts class. When you remove the shortcut for an element you don't check if the element's shortcuts are empty and left the element in the registeredShortcuts map (with an empty array):
editor.js/src/components/utils/shortcuts.ts
Line 89 in b619946
If you create a new EditorJS and destroys it, you will see a bunch of detached elements referenced by registeredShortcuts map.
Steps to reproduce:
You can reproduce the issue with this simple html:
Press "Remove" button and take a snapshot in Chrome dev tools. You will see detached HTMLDivElement's referenced by registeredShortcuts:
If you remove the element from the map when the shortcuts array is empty, the problem disappears:
The text was updated successfully, but these errors were encountered: