diff --git a/packages/twenty-front/src/modules/object-record/relation-picker/components/MultiRecordSelect.tsx b/packages/twenty-front/src/modules/object-record/relation-picker/components/MultiRecordSelect.tsx index 0730c05059..87c0532208 100644 --- a/packages/twenty-front/src/modules/object-record/relation-picker/components/MultiRecordSelect.tsx +++ b/packages/twenty-front/src/modules/object-record/relation-picker/components/MultiRecordSelect.tsx @@ -27,6 +27,7 @@ export const StyledSelectableItem = styled(SelectableItem)` height: 100%; width: 100%; `; + export const MultiRecordSelect = ({ onChange, onSubmit, diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelFieldPreview.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelFieldPreview.tsx index 31b78cd0d4..a7b69af6a9 100644 --- a/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelFieldPreview.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelFieldPreview.tsx @@ -10,7 +10,7 @@ import { FieldContext } from '@/object-record/record-field/contexts/FieldContext import { BooleanFieldInput } from '@/object-record/record-field/meta-types/input/components/BooleanFieldInput'; import { RatingFieldInput } from '@/object-record/record-field/meta-types/input/components/RatingFieldInput'; import { SettingsDataModelSetFieldValueEffect } from '@/settings/data-model/fields/preview/components/SettingsDataModelSetFieldValueEffect'; -import { SettingsDataModelSetRecordEffect } from '@/settings/data-model/fields/preview/components/SettingsDataModelSetRecordEffect'; +import { SettingsDataModelSetPreviewRecordEffect } from '@/settings/data-model/fields/preview/components/SettingsDataModelSetRecordEffect'; import { useFieldPreviewValue } from '@/settings/data-model/fields/preview/hooks/useFieldPreviewValue'; import { usePreviewRecord } from '@/settings/data-model/fields/preview/hooks/usePreviewRecord'; import { FieldMetadataType } from '~/generated-metadata/graphql'; @@ -96,7 +96,7 @@ export const SettingsDataModelFieldPreview = ({ return ( <> {previewRecord ? ( - diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelSetFieldValueEffect.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelSetFieldValueEffect.tsx index 050ecbd68c..110591d3e1 100644 --- a/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelSetFieldValueEffect.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelSetFieldValueEffect.tsx @@ -1,7 +1,7 @@ import { useSetRecordFieldValue } from '@/object-record/record-store/contexts/RecordFieldValueSelectorContext'; import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState'; import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector'; -import { previewRecordIdState } from '@/settings/data-model/fields/preview/states/previewRecordIdState'; +import { settingsPreviewRecordIdState } from '@/settings/data-model/fields/preview/states/settingsPreviewRecordIdState'; import { useEffect } from 'react'; import { useRecoilValue, useSetRecoilState } from 'recoil'; import { isDefined } from '~/utils/isDefined'; @@ -17,10 +17,10 @@ export const SettingsDataModelSetFieldValueEffect = ({ fieldName, value, }: SettingsDataModelSetFieldValueEffectProps) => { - const previewRecordId = useRecoilValue(previewRecordIdState); + const settingsPreviewRecordId = useRecoilValue(settingsPreviewRecordIdState); const upsertedPreviewRecord = useRecoilValue( - recordStoreFamilyState(previewRecordId ?? ''), + recordStoreFamilyState(settingsPreviewRecordId ?? ''), ); const setFieldValue = useSetRecoilState( diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelSetRecordEffect.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelSetRecordEffect.tsx index e5ceaf22f8..331f06e19c 100644 --- a/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelSetRecordEffect.tsx +++ b/packages/twenty-front/src/modules/settings/data-model/fields/preview/components/SettingsDataModelSetRecordEffect.tsx @@ -1,34 +1,36 @@ import { useSetRecordFieldValue } from '@/object-record/record-store/contexts/RecordFieldValueSelectorContext'; import { useUpsertRecordsInStore } from '@/object-record/record-store/hooks/useUpsertRecordsInStore'; import { ObjectRecord } from '@/object-record/types/ObjectRecord'; -import { previewRecordIdState } from '@/settings/data-model/fields/preview/states/previewRecordIdState'; +import { settingsPreviewRecordIdState } from '@/settings/data-model/fields/preview/states/settingsPreviewRecordIdState'; import { useEffect } from 'react'; import { useSetRecoilState } from 'recoil'; -type SettingsDataModelSetRecordEffectProps = { +type SettingsDataModelSetPreviewRecordEffectProps = { record: ObjectRecord; fieldName: string; }; -export const SettingsDataModelSetRecordEffect = ({ +export const SettingsDataModelSetPreviewRecordEffect = ({ record, fieldName, -}: SettingsDataModelSetRecordEffectProps) => { +}: SettingsDataModelSetPreviewRecordEffectProps) => { const { upsertRecords: upsertRecordsInStore } = useUpsertRecordsInStore(); const setRecordFieldValue = useSetRecordFieldValue(); - const setPreviewRecordId = useSetRecoilState(previewRecordIdState); + const setSettingsPreviewRecordId = useSetRecoilState( + settingsPreviewRecordIdState, + ); useEffect(() => { upsertRecordsInStore([record]); setRecordFieldValue(record.id, fieldName, record[fieldName]); - setPreviewRecordId(record.id); + setSettingsPreviewRecordId(record.id); }, [ record, upsertRecordsInStore, setRecordFieldValue, fieldName, - setPreviewRecordId, + setSettingsPreviewRecordId, ]); return null; diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/preview/states/previewRecordIdState.ts b/packages/twenty-front/src/modules/settings/data-model/fields/preview/states/previewRecordIdState.ts deleted file mode 100644 index 3d37a853a6..0000000000 --- a/packages/twenty-front/src/modules/settings/data-model/fields/preview/states/previewRecordIdState.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { createState } from 'twenty-ui'; - -export const previewRecordIdState = createState({ - key: 'previewRecordId', - defaultValue: null, -}); diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/preview/states/settingsPreviewRecordIdState.ts b/packages/twenty-front/src/modules/settings/data-model/fields/preview/states/settingsPreviewRecordIdState.ts new file mode 100644 index 0000000000..68a5bbff96 --- /dev/null +++ b/packages/twenty-front/src/modules/settings/data-model/fields/preview/states/settingsPreviewRecordIdState.ts @@ -0,0 +1,6 @@ +import { createState } from 'twenty-ui'; + +export const settingsPreviewRecordIdState = createState({ + key: 'settingsPreviewRecordIdState', + defaultValue: null, +});