Skip to content

Commit 23746ed

Browse files
lucasbordeauWeiko
authored andcommitted
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()`.
1 parent 8a3ece6 commit 23746ed

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/twenty-front/src/modules/object-record/record-table/record-table-cell/components/RecordTableCellSoftFocusMode.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { ReactElement, useContext, useEffect, useRef } from 'react';
2-
import isEmpty from 'lodash.isempty';
32
import { useRecoilValue } from 'recoil';
43
import { Key } from 'ts-key-enum';
54
import { IconArrowUpRight } from 'twenty-ui';
65

76
import { useClearField } from '@/object-record/record-field/hooks/useClearField';
87
import { useGetButtonIcon } from '@/object-record/record-field/hooks/useGetButtonIcon';
98
import { useIsFieldClearable } from '@/object-record/record-field/hooks/useIsFieldClearable';
9+
import { useIsFieldEmpty } from '@/object-record/record-field/hooks/useIsFieldEmpty';
1010
import { useIsFieldInputOnly } from '@/object-record/record-field/hooks/useIsFieldInputOnly';
1111
import { useToggleEditOnlyInput } from '@/object-record/record-field/hooks/useToggleEditOnlyInput';
1212
import { RecordTableCellContext } from '@/object-record/record-table/contexts/RecordTableCellContext';
@@ -16,6 +16,7 @@ import { useOpenRecordTableCellFromCell } from '@/object-record/record-table/rec
1616
import { isSoftFocusUsingMouseState } from '@/object-record/record-table/states/isSoftFocusUsingMouseState';
1717
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
1818
import { isNonTextWritingKey } from '@/ui/utilities/hotkey/utils/isNonTextWritingKey';
19+
import { isDefined } from '~/utils/isDefined';
1920

2021
import { TableHotkeyScope } from '../../types/TableHotkeyScope';
2122

@@ -40,6 +41,8 @@ export const RecordTableCellSoftFocusMode = ({
4041

4142
const isFieldInputOnly = useIsFieldInputOnly();
4243

44+
const isEmpty = useIsFieldEmpty();
45+
4346
const isFieldClearable = useIsFieldClearable();
4447

4548
const toggleEditOnlyInput = useToggleEditOnlyInput();
@@ -119,7 +122,7 @@ export const RecordTableCellSoftFocusMode = ({
119122
const buttonIcon = isFirstColumn ? IconArrowUpRight : customButtonIcon;
120123

121124
const showButton =
122-
!!buttonIcon &&
125+
isDefined(buttonIcon) &&
123126
!editModeContentOnly &&
124127
(!isFirstColumn || !isEmpty) &&
125128
!isReadOnly;

0 commit comments

Comments
 (0)