Replace entityId by recordId in the front end. (#6355)

Hey @lucasbordeau, I replaced every `entityId` with `recordId` in the
frontend.

### Some clarifications:

1. At [this
line](https://github.com/ehconitin/twenty/commit/0b207d26b6e78da349af34cf44585d89cb59adb7#diff-b4f415dd1f060307ad61f64394ee96b2912f6015e26c7fd2eab4b8c6a84d2d07L14),
I changed `recordId` to `selectedRecordId` because that component has
`entityId` defined in code at [this
line](https://github.com/ehconitin/twenty/commit/0b207d26b6e78da349af34cf44585d89cb59adb7#diff-b4f415dd1f060307ad61f64394ee96b2912f6015e26c7fd2eab4b8c6a84d2d07L55)
which was to be changed to `recordId`. To avoid repeated constants, I
changed the arguments to `selectedRecordIds`.

2. At the following links:
- [File
1](https://github.com/ehconitin/twenty/commit/0b207d26b6e78da349af34cf44585d89cb59adb7#diff-52b780bdd4cfc582ca7e1b457dbbd63733bfbb7790fc421054bbd2dbf0389e16)
- [File
2](https://github.com/ehconitin/twenty/commit/0b207d26b6e78da349af34cf44585d89cb59adb7#diff-6d47cb9a59dfcf6b1495937084ae799a61da6afccb21208f04ce8e1f5afca0e4)
- [File
3](https://github.com/ehconitin/twenty/commit/0b207d26b6e78da349af34cf44585d89cb59adb7#diff-821815783f9968f1da3cd437fc9d1d1666d12dc331d279cc5fbd9817bc2df2bf)

It seems to be the tests. As I can see, it is checking for both
`objectFilterDropdownSelectedEntityIdState` and
`objectFilterDropdownSelectedRecordIdsState`. Since `entityIds` are
supposed to be removed and `recordedId` state is already being checked,
I commented out all the `entityidState` code. If they are to be removed
or uncommented, please let me know, and I will do as expected.

---------

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
This commit is contained in:
nitin
2024-08-07 12:22:57 +05:30
committed by GitHub
parent 0c99bfbc31
commit a7941315e7
102 changed files with 303 additions and 310 deletions
@@ -89,7 +89,7 @@ export const SettingsDataModelFieldPreview = ({
const fieldName =
fieldMetadataItem.name || `${fieldMetadataItem.type}-new-field`;
const entityId =
const recordId =
previewRecord?.id ??
`${objectMetadataItem.nameSingular}-${fieldName}-preview`;
@@ -99,7 +99,7 @@ export const SettingsDataModelFieldPreview = ({
<SettingsDataModelSetRecordEffect record={previewRecord} />
) : (
<SettingsDataModelSetFieldValueEffect
entityId={entityId}
recordId={recordId}
fieldName={fieldName}
value={fieldPreviewValue}
/>
@@ -116,7 +116,7 @@ export const SettingsDataModelFieldPreview = ({
)}
<FieldContext.Provider
value={{
entityId,
recordId,
isLabelIdentifier,
fieldDefinition: {
type: fieldMetadataItem.type,
@@ -5,19 +5,19 @@ import { useSetRecordFieldValue } from '@/object-record/record-store/contexts/Re
import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector';
type SettingsDataModelSetFieldValueEffectProps = {
entityId: string;
recordId: string;
fieldName: string;
value: unknown;
};
export const SettingsDataModelSetFieldValueEffect = ({
entityId,
recordId,
fieldName,
value,
}: SettingsDataModelSetFieldValueEffectProps) => {
const setFieldValue = useSetRecoilState(
recordStoreFamilySelector({
recordId: entityId,
recordId,
fieldName,
}),
);
@@ -26,8 +26,8 @@ export const SettingsDataModelSetFieldValueEffect = ({
useEffect(() => {
setFieldValue(value);
setRecordFieldValue(entityId, fieldName, value);
}, [value, setFieldValue, setRecordFieldValue, entityId, fieldName]);
setRecordFieldValue(recordId, fieldName, value);
}, [value, setFieldValue, setRecordFieldValue, recordId, fieldName]);
return null;
};