Added hotkeyScopes to serverless functions in settings (#6710)
Fixes #6656 Is this the right way to implement keyboard listeners? Please let me know, I'll make the changes accordingly. :) https://github.com/user-attachments/assets/af71d340-ead9-4659-81e6-a440522a194f --------- Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
20
packages/twenty-front/src/hooks/useHotkeyScopeOnMount.ts
Normal file
20
packages/twenty-front/src/hooks/useHotkeyScopeOnMount.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export const useHotkeyScopeOnMount = (hotkeyScope: string) => {
|
||||
const {
|
||||
goBackToPreviousHotkeyScope,
|
||||
setHotkeyScopeAndMemorizePreviousScope,
|
||||
} = usePreviousHotkeyScope();
|
||||
|
||||
useEffect(() => {
|
||||
setHotkeyScopeAndMemorizePreviousScope(hotkeyScope);
|
||||
return () => {
|
||||
goBackToPreviousHotkeyScope();
|
||||
};
|
||||
}, [
|
||||
hotkeyScope,
|
||||
setHotkeyScopeAndMemorizePreviousScope,
|
||||
goBackToPreviousHotkeyScope,
|
||||
]);
|
||||
};
|
||||
Reference in New Issue
Block a user