Fixed button icon bug (#5670)
There was a bug with the isEmpty variable actually being a function from lodash instead of the result of `isFieldEmpty()`.
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
import { ReactElement, useContext, useEffect, useRef } from 'react';
|
||||
import isEmpty from 'lodash.isempty';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { Key } from 'ts-key-enum';
|
||||
import { IconArrowUpRight } from 'twenty-ui';
|
||||
@ -7,6 +6,7 @@ import { IconArrowUpRight } from 'twenty-ui';
|
||||
import { useClearField } from '@/object-record/record-field/hooks/useClearField';
|
||||
import { useGetButtonIcon } from '@/object-record/record-field/hooks/useGetButtonIcon';
|
||||
import { useIsFieldClearable } from '@/object-record/record-field/hooks/useIsFieldClearable';
|
||||
import { useIsFieldEmpty } from '@/object-record/record-field/hooks/useIsFieldEmpty';
|
||||
import { useIsFieldInputOnly } from '@/object-record/record-field/hooks/useIsFieldInputOnly';
|
||||
import { useToggleEditOnlyInput } from '@/object-record/record-field/hooks/useToggleEditOnlyInput';
|
||||
import { RecordTableCellContext } from '@/object-record/record-table/contexts/RecordTableCellContext';
|
||||
@ -16,6 +16,7 @@ import { useOpenRecordTableCellFromCell } from '@/object-record/record-table/rec
|
||||
import { isSoftFocusUsingMouseState } from '@/object-record/record-table/states/isSoftFocusUsingMouseState';
|
||||
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
||||
import { isNonTextWritingKey } from '@/ui/utilities/hotkey/utils/isNonTextWritingKey';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
import { TableHotkeyScope } from '../../types/TableHotkeyScope';
|
||||
|
||||
@ -40,6 +41,8 @@ export const RecordTableCellSoftFocusMode = ({
|
||||
|
||||
const isFieldInputOnly = useIsFieldInputOnly();
|
||||
|
||||
const isEmpty = useIsFieldEmpty();
|
||||
|
||||
const isFieldClearable = useIsFieldClearable();
|
||||
|
||||
const toggleEditOnlyInput = useToggleEditOnlyInput();
|
||||
@ -119,7 +122,7 @@ export const RecordTableCellSoftFocusMode = ({
|
||||
const buttonIcon = isFirstColumn ? IconArrowUpRight : customButtonIcon;
|
||||
|
||||
const showButton =
|
||||
!!buttonIcon &&
|
||||
isDefined(buttonIcon) &&
|
||||
!editModeContentOnly &&
|
||||
(!isFirstColumn || !isEmpty) &&
|
||||
!isReadOnly;
|
||||
|
||||
Reference in New Issue
Block a user