Web: Accounts: fixed keydown event unmount

This commit is contained in:
Nikita Gopienko 2024-06-03 17:49:44 +03:00
parent 02fc9583c6
commit f50fdbfce1

View File

@ -77,10 +77,10 @@ const useAccountsHotkeys = ({
useEffect(() => {
const throttledKeyDownEvent = throttle(onKeyDown, 300);
window.addEventListener("keydown", onKeyDown);
window.addEventListener("keydown", throttledKeyDownEvent);
return () => {
window.removeEventListener("keypress", throttledKeyDownEvent);
window.removeEventListener("keydown", throttledKeyDownEvent);
};
}, [onKeyDown]);