Skip to content

The open alternative to Salesforce, designed for AI.

some ts-error-fixes (#6563)

nitin43700ad1865b
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useActorFieldDisplay.ts b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useActorFieldDisplay.ts
index c870b96e61a..aa6378e135d 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useActorFieldDisplay.ts
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useActorFieldDisplay.ts
@@ -7,14 +7,14 @@ import { AuthContext } from '@/auth/contexts/AuthContext';
import { FieldContext } from '../../contexts/FieldContext';
export const useActorFieldDisplay = () => {
- const { entityId, fieldDefinition } = useContext(FieldContext);
+ const { recordId, fieldDefinition } = useContext(FieldContext);
const { currentWorkspaceMembers } = useContext(AuthContext);
const fieldName = fieldDefinition.metadata.fieldName;
const fieldValue = useRecordFieldValue<FieldActorValue | undefined>(
- entityId,
+ recordId,
fieldName,
);
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RelationFromManyFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RelationFromManyFieldInput.tsx
index 3bcebb3caf4..e7122c451b0 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RelationFromManyFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RelationFromManyFieldInput.tsx
@@ -19,7 +19,7 @@ export type RelationFromManyFieldInputProps = {
export const RelationFromManyFieldInput = ({
onSubmit,
}: RelationFromManyFieldInputProps) => {
- const { fieldDefinition, entityId } = useContext(FieldContext);
+ const { fieldDefinition, recordId } = useContext(FieldContext);
const relationPickerScopeId = `relation-picker-${fieldDefinition.fieldMetadataId}`;
const { updateRelation } = useUpdateRelationFromManyFieldInput({
scopeId: relationPickerScopeId,
@@ -48,7 +48,7 @@ export const RelationFromManyFieldInput = ({
relationFieldDefinition.metadata.relationObjectMetadataNameSingular,
relationObjectMetadataItem,
relationFieldMetadataItem,
- entityId,
+ recordId,
});
return (
diff --git a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCell.tsx b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCell.tsx
index 7c22b077b61..dff1504c0d8 100644
--- a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCell.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCell.tsx
@@ -14,8 +14,8 @@ import { RelationPickerHotkeyScope } from '@/object-record/relation-picker/types
import { useInlineCell } from '../hooks/useInlineCell';
import { useIsFieldReadOnly } from '@/object-record/record-field/hooks/useIsFieldReadOnly';
-import { RecordInlineCellContainer } from './RecordInlineCellContainer';
import { getRecordFieldInputId } from '@/object-record/utils/getRecordFieldInputId';
+import { RecordInlineCellContainer } from './RecordInlineCellContainer';
type RecordInlineCellProps = {
readonly?: boolean;
@@ -98,7 +98,10 @@ export const RecordInlineCell = ({
isCentered={isCentered}
editModeContent={
<FieldInput
- recordFieldInputdId={getRecordFieldInputId(recordId, fieldDefinition?.metadata?.fieldName)}
+ recordFieldInputdId={getRecordFieldInputId(
+ recordId,
+ fieldDefinition?.metadata?.fieldName,
+ )}
onEnter={handleEnter}
onCancel={handleCancel}
onEscape={handleEscape}
diff --git a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellContainer.tsx b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellContainer.tsx
index 1cd668d0bec..579acab672e 100644
--- a/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellContainer.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-inline-cell/components/RecordInlineCellContainer.tsx
@@ -6,9 +6,9 @@ import { AppTooltip, IconComponent, TooltipDelay } from 'twenty-ui';
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
import { useFieldFocus } from '@/object-record/record-field/hooks/useFieldFocus';
import { RecordInlineCellValue } from '@/object-record/record-inline-cell/components/RecordInlineCellValue';
+import { getRecordFieldInputId } from '@/object-record/utils/getRecordFieldInputId';
import { EllipsisDisplay } from '@/ui/field/display/components/EllipsisDisplay';
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
-import { getRecordFieldInputId } from '@/object-record/utils/getRecordFieldInputId';
const StyledIconContainer = styled.div`
align-items: center;
@@ -112,7 +112,10 @@ export const RecordInlineCellContainer = ({
};
const theme = useTheme();
- const labelId = `label-${getRecordFieldInputId(recordId,fieldDefinition?.metadata?.fieldName)}`;
+ const labelId = `label-${getRecordFieldInputId(
+ recordId,
+ fieldDefinition?.metadata?.fieldName,
+ )}`;
return (
<StyledInlineCellBaseContainer
diff --git a/packages/twenty-front/src/modules/object-record/utils/getRecordFieldInputId.ts b/packages/twenty-front/src/modules/object-record/utils/getRecordFieldInputId.ts
index e40d65a5615..35a563993df 100644
--- a/packages/twenty-front/src/modules/object-record/utils/getRecordFieldInputId.ts
+++ b/packages/twenty-front/src/modules/object-record/utils/getRecordFieldInputId.ts
@@ -1,4 +1,6 @@
-export const getRecordFieldInputId = (recordId: string, fieldName?: string): string => {
- return `${recordId}-${fieldName}`;
- };
-
\ No newline at end of file
+export const getRecordFieldInputId = (
+ recordId: string,
+ fieldName?: string,
+): string => {
+ return `${recordId}-${fieldName}`;
+};
diff --git a/packages/twenty-front/src/modules/ui/input/editor/components/CustomAddBlockItem.tsx b/packages/twenty-front/src/modules/ui/input/editor/components/CustomAddBlockItem.tsx
index e4f603117d0..2eeb9862173 100644
--- a/packages/twenty-front/src/modules/ui/input/editor/components/CustomAddBlockItem.tsx
+++ b/packages/twenty-front/src/modules/ui/input/editor/components/CustomAddBlockItem.tsx
@@ -18,6 +18,10 @@ export const CustomAddBlockItem = ({
}: CustomAddBlockItemProps) => {
const Components = useComponentsContext();
+ if (!Components) {
+ return null;
+ }
+
const handleClick = () => {
const blockIdentifier = editor.getTextCursorPosition().block;
const currentBlockContent = blockIdentifier?.content as