Skip to content

The open alternative to Salesforce, designed for AI.

Fix rating field not editable if null (#6110)

Weikoc57c5b255419
diff --git a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellDisplayMode.tsx b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellDisplayMode.tsx
index 5c236d261f5..eacdf2dc4b7 100644
--- a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellDisplayMode.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellDisplayMode.tsx
@@ -3,6 +3,7 @@ import styled from '@emotion/styled';
import { useFieldFocus } from '@/object-record/record-field/hooks/useFieldFocus';
import { useIsFieldEmpty } from '@/object-record/record-field/hooks/useIsFieldEmpty';
+import { useIsFieldInputOnly } from '@/object-record/record-field/hooks/useIsFieldInputOnly';
import { RecordInlineCellContainerProps } from '@/object-record/record-inline-cell/components/RecordInlineCellContainer';
import { RecordInlineCellButton } from '@/object-record/record-inline-cell/components/RecordInlineCellEditButton';
@@ -76,6 +77,10 @@ export const RecordInlineCellDisplayMode = ({
!isDisplayModeContentEmpty &&
!editModeContentOnly;
+ const isFieldInputOnly = useIsFieldInputOnly();
+
+ const shouldDisplayEditModeOnFocus = isFocused && isFieldInputOnly;
+
return (
<>
<StyledRecordInlineCellNormalModeOuterContainer
@@ -84,7 +89,8 @@ export const RecordInlineCellDisplayMode = ({
isHovered={isHovered}
>
<StyledRecordInlineCellNormalModeInnerContainer>
- {isDisplayModeContentEmpty || !children ? (
+ {(isDisplayModeContentEmpty && !shouldDisplayEditModeOnFocus) ||
+ !children ? (
<StyledEmptyField>{emptyPlaceholder}</StyledEmptyField>
) : (
children