Fix/relation picker (#546)

* FIx pickers

* Fix

* Fix lint

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Lucas Bordeau
2023-07-09 03:43:41 +02:00
committed by GitHub
parent 9d25d003ca
commit 795bead1bb
6 changed files with 29 additions and 9 deletions

View File

@ -1,7 +1,12 @@
import { useRecoilValue } from 'recoil';
import { useCurrentHotkeysScope } from '@/hotkeys/hooks/useCurrentHotkeysScope';
import { useResetHotkeysScopeStack } from '@/hotkeys/hooks/useResetHotkeysScopeStack';
import { InternalHotkeysScope } from '@/hotkeys/types/internal/InternalHotkeysScope';
import { isSoftFocusActiveState } from '../states/isSoftFocusActiveState';
import { isSomeInputInEditModeState } from '../states/isSomeInputInEditModeState';
import { useCloseCurrentCellInEditMode } from './useClearCellInEditMode';
import { useDisableSoftFocus } from './useDisableSoftFocus';
@ -12,7 +17,15 @@ export function useLeaveTableFocus() {
const disableSoftFocus = useDisableSoftFocus();
const closeCurrentCellInEditMode = useCloseCurrentCellInEditMode();
const isSoftFocusActive = useRecoilValue(isSoftFocusActiveState);
const isSomeInputInEditMode = useRecoilValue(isSomeInputInEditModeState);
return async function leaveTableFocus() {
// TODO: replace with scope ancestor ?
if (!isSoftFocusActive && !isSomeInputInEditMode) {
return;
}
if (currentHotkeysScope?.scope === InternalHotkeysScope.Table) {
return;
}