Fixed (#11482)
This PR fixes many small bugs around the recent hotkey scope refactor. - Removed unused ActionBar files - Created components CommandMenuOpenContainer and KeyboardShortcutMenuOpenContent to avoid mounting listeners when not needed - Added DEFAULT_CELL_SCOPE where missing in some field inputs - Called setHotkeyScopeAndMemorizePreviousScope instead of setHotkeyScope in new useOpenFieldInputEditMode hook - Broke down RecordTableBodyUnselectEffect into multiple simpler effect components that are mounted only when needed to avoid listening for keyboard and clickoutside event - Re-implemented recently deleted table cell soft focus component logic into RecordTableCellDisplayMode - Created component selector isAtLeastOneTableRowSelectedSelector - Drill down hotkey scope when opening a dropdown - Improved debug logs
This commit is contained in:
@ -140,7 +140,7 @@ export const Dropdown = ({
|
||||
dropdownHotkeyScope,
|
||||
);
|
||||
|
||||
toggleDropdown();
|
||||
toggleDropdown(dropdownHotkeyScope);
|
||||
onClickOutside?.();
|
||||
},
|
||||
[dropdownId, dropdownHotkeyScope, onClickOutside, toggleDropdown],
|
||||
|
||||
@ -83,11 +83,11 @@ export const useDropdown = (dropdownId?: string) => {
|
||||
],
|
||||
);
|
||||
|
||||
const toggleDropdown = () => {
|
||||
const toggleDropdown = (dropdownHotkeyScopeFromProps?: HotkeyScope) => {
|
||||
if (isDropdownOpen) {
|
||||
closeDropdown();
|
||||
} else {
|
||||
openDropdown();
|
||||
openDropdown(dropdownHotkeyScopeFromProps);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -20,11 +20,18 @@ export const usePreviousHotkeyScope = (memoizeKey = 'global') => {
|
||||
.getValue();
|
||||
|
||||
if (!previousHotkeyScope) {
|
||||
if (DEBUG_HOTKEY_SCOPE) {
|
||||
logDebug(`DEBUG: no previous hotkey scope ${memoizeKey}`);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (DEBUG_HOTKEY_SCOPE) {
|
||||
logDebug('DEBUG: goBackToPreviousHotkeyScope', previousHotkeyScope);
|
||||
logDebug(
|
||||
`DEBUG: goBackToPreviousHotkeyScope ${previousHotkeyScope.scope}`,
|
||||
previousHotkeyScope,
|
||||
);
|
||||
}
|
||||
|
||||
setHotkeyScope(
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { useRecoilCallback } from 'recoil';
|
||||
|
||||
import { DEBUG_HOTKEY_SCOPE } from '@/ui/utilities/hotkey/hooks/useScopedHotkeyCallback';
|
||||
import { logDebug } from '~/utils/logDebug';
|
||||
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { logDebug } from '~/utils/logDebug';
|
||||
import { DEFAULT_HOTKEYS_SCOPE_CUSTOM_SCOPES } from '../constants/DefaultHotkeysScopeCustomScopes';
|
||||
import { currentHotkeyScopeState } from '../states/internal/currentHotkeyScopeState';
|
||||
import { internalHotkeysEnabledScopesState } from '../states/internal/internalHotkeysEnabledScopesState';
|
||||
@ -84,7 +84,7 @@ export const useSetHotkeyScope = () =>
|
||||
scopesToSet.push(newHotkeyScope.scope);
|
||||
|
||||
if (DEBUG_HOTKEY_SCOPE) {
|
||||
logDebug('DEBUG: set new hotkey scope', {
|
||||
logDebug(`DEBUG: set new hotkey scope : ${newHotkeyScope.scope}`, {
|
||||
scopesToSet,
|
||||
newHotkeyScope,
|
||||
});
|
||||
|
||||
@ -162,6 +162,21 @@ export const useListenClickOutside = <T extends Element>({
|
||||
!isMouseDownInside &&
|
||||
!isClickedOnExcluded;
|
||||
|
||||
if (CLICK_OUTSIDE_DEBUG_MODE) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('click outside compare ref', {
|
||||
listenerId,
|
||||
shouldTrigger,
|
||||
clickedOnAtLeastOneRef,
|
||||
isMouseDownInside,
|
||||
isListening,
|
||||
hasMouseDownHappened,
|
||||
isClickedOnExcluded,
|
||||
enabled,
|
||||
event,
|
||||
});
|
||||
}
|
||||
|
||||
if (shouldTrigger) {
|
||||
callback(event);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user