- Fixed date input fields : proper hotkey management, like other fields - Removed DropdownUnmountEffect which was causing many bugs.
25 lines
685 B
TypeScript
25 lines
685 B
TypeScript
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
|
|
import { useEffect } from 'react';
|
|
|
|
/**
|
|
* @deprecated This hook uses useEffect
|
|
* Use event handlers and imperative code to manage hotkey scope changes.
|
|
*/
|
|
export const useHotkeyScopeOnMount = (hotkeyScope: string) => {
|
|
const {
|
|
goBackToPreviousHotkeyScope,
|
|
setHotkeyScopeAndMemorizePreviousScope,
|
|
} = usePreviousHotkeyScope();
|
|
|
|
useEffect(() => {
|
|
setHotkeyScopeAndMemorizePreviousScope(hotkeyScope);
|
|
return () => {
|
|
goBackToPreviousHotkeyScope();
|
|
};
|
|
}, [
|
|
hotkeyScope,
|
|
setHotkeyScopeAndMemorizePreviousScope,
|
|
goBackToPreviousHotkeyScope,
|
|
]);
|
|
};
|