mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-18 23:39:10 +00:00
added cleanup function
This commit is contained in:
parent
13584d74dd
commit
84c32a4e40
|
@ -77,6 +77,14 @@ export const TopBar: React.FC<TopBarProps> = (props) => {
|
|||
searchRef.current.focus()
|
||||
}
|
||||
})
|
||||
return () => {
|
||||
//remove event listener
|
||||
document.removeEventListener('keydown', (e) => {
|
||||
if (e.metaKey && e.key === 'k' && searchRef.current) {
|
||||
searchRef.current.focus()
|
||||
}
|
||||
})
|
||||
}
|
||||
},[])
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in a new issue