From bcb582ffa048fd5b02a199de1a3b8f8a4a341a87 Mon Sep 17 00:00:00 2001 From: Lucas Bordeau Date: Wed, 29 May 2024 21:29:33 +0200 Subject: [PATCH] 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()`. --- .../components/RecordTableCellSoftFocusMode.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellSoftFocusMode.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellSoftFocusMode.tsx index 3aedd7870f6f..7862d47d2cf8 100644 --- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellSoftFocusMode.tsx +++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellSoftFocusMode.tsx @@ -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;