fixes #4365 --------- Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
committed by
GitHub
parent
c0d0f8d78d
commit
99f8f8fedb
@ -48,7 +48,7 @@ export const MultiRecordSelect = ({
|
||||
const { objectRecordsIdsMultiSelectState, recordMultiSelectIsLoadingState } =
|
||||
useObjectRecordMultiSelectScopedStates(relationPickerScopedId);
|
||||
|
||||
const { handleResetSelectedPosition } = useSelectableList(
|
||||
const { resetSelectedItem } = useSelectableList(
|
||||
MULTI_OBJECT_RECORD_SELECT_SELECTABLE_LIST_ID,
|
||||
);
|
||||
const recordMultiSelectIsLoading = useRecoilValue(
|
||||
@ -79,10 +79,10 @@ export const MultiRecordSelect = ({
|
||||
() => {
|
||||
onSubmit?.();
|
||||
goBackToPreviousHotkeyScope();
|
||||
handleResetSelectedPosition();
|
||||
resetSelectedItem();
|
||||
},
|
||||
relationPickerScopedId,
|
||||
[onSubmit, goBackToPreviousHotkeyScope, handleResetSelectedPosition],
|
||||
[onSubmit, goBackToPreviousHotkeyScope, resetSelectedItem],
|
||||
);
|
||||
|
||||
const debouncedOnCreate = useDebouncedCallback(
|
||||
@ -123,7 +123,7 @@ export const MultiRecordSelect = ({
|
||||
hotkeyScope={relationPickerScopedId}
|
||||
onEnter={(selectedId) => {
|
||||
onChange?.(selectedId);
|
||||
handleResetSelectedPosition();
|
||||
resetSelectedItem();
|
||||
}}
|
||||
>
|
||||
{objectRecordsIdsMultiSelect?.map((recordId) => {
|
||||
@ -133,7 +133,7 @@ export const MultiRecordSelect = ({
|
||||
objectRecordId={recordId}
|
||||
onChange={(recordId) => {
|
||||
onChange?.(recordId);
|
||||
handleResetSelectedPosition();
|
||||
resetSelectedItem();
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
@ -27,7 +27,6 @@ export const SelectableMenuItemSelect = ({
|
||||
);
|
||||
|
||||
const isSelectedItemId = useRecoilValue(isSelectedItemIdSelector(entity.id));
|
||||
|
||||
return (
|
||||
<StyledSelectableItem itemId={entity.id} key={entity.id}>
|
||||
<MenuItemSelectAvatar
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useRef } from 'react';
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import { useRef } from 'react';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { Key } from 'ts-key-enum';
|
||||
import { IconComponent, IconPlus } from 'twenty-ui';
|
||||
@ -92,8 +92,9 @@ export const SingleEntitySelectMenuItems = ({
|
||||
isDefined(entity) && isNonEmptyString(entity.name),
|
||||
);
|
||||
|
||||
const { isSelectedItemIdSelector, handleResetSelectedPosition } =
|
||||
useSelectableList(SINGLE_ENTITY_SELECT_BASE_LIST);
|
||||
const { isSelectedItemIdSelector, resetSelectedItem } = useSelectableList(
|
||||
SINGLE_ENTITY_SELECT_BASE_LIST,
|
||||
);
|
||||
|
||||
const isSelectedAddNewButton = useRecoilValue(
|
||||
isSelectedItemIdSelector('add-new'),
|
||||
@ -110,11 +111,11 @@ export const SingleEntitySelectMenuItems = ({
|
||||
useScopedHotkeys(
|
||||
[Key.Escape],
|
||||
() => {
|
||||
handleResetSelectedPosition();
|
||||
resetSelectedItem();
|
||||
onCancel?.();
|
||||
},
|
||||
hotkeyScope,
|
||||
[onCancel, handleResetSelectedPosition],
|
||||
[onCancel, resetSelectedItem],
|
||||
);
|
||||
|
||||
const selectableItemIds = entitiesInDropdown.map((entity) => entity.id);
|
||||
@ -134,7 +135,7 @@ export const SingleEntitySelectMenuItems = ({
|
||||
);
|
||||
onEntitySelected(entitiesInDropdown[entityIndex]);
|
||||
}
|
||||
handleResetSelectedPosition();
|
||||
resetSelectedItem();
|
||||
}}
|
||||
>
|
||||
<DropdownMenuItemsContainer hasMaxHeight>
|
||||
|
||||
Reference in New Issue
Block a user