Files
twenty/front/src/modules/hotkeys/hooks/useResetHotkeysScopeStack.ts
T
Lucas Bordeau 66dcc9b2e1 Feat/better hotkeys scope (#526)
* Working version

* fix

* Fixed console log

* Fix lint

* wip

* Fix

* Fix

* consolelog

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2023-07-07 18:53:05 -07:00

19 lines
563 B
TypeScript

import { useResetRecoilState } from 'recoil';
import { hotkeysScopeStackState } from '../states/internal/hotkeysScopeStackState';
import { useAddToHotkeysScopeStack } from './useAddToHotkeysScopeStack';
export function useResetHotkeysScopeStack() {
const resetHotkeysScopeStack = useResetRecoilState(hotkeysScopeStackState);
const addHotkeysScopedStack = useAddToHotkeysScopeStack();
return function reset(toFirstScope?: string) {
resetHotkeysScopeStack();
if (toFirstScope) {
addHotkeysScopedStack({ scope: toFirstScope });
}
};
}