refactor: rename ObjectMetadataItem to EnrichedObjectMetadataItem and clean up metadata flows (#18830)

## Summary

- Renames `ObjectMetadataItem` to `EnrichedObjectMetadataItem` across
the entire frontend (~440 files) to clarify that this type includes
derived fields (`readableFields`, `updatableFields`, nested `fields[]`,
`indexMetadatas[]`) computed at read time from the metadata store
- Creates `splitObjectMetadataGqlResponse` that goes directly from a
GraphQL `ObjectMetadataItemsQuery` response to flat store items
(combining the old
`mapPaginatedObjectMetadataItemsToObjectMetadataItems` +
`splitObjectMetadataItemWithRelated` two-step flow into one call)
- Removes `ObjectMetadataItemWithRelated` type and all "WithRelated"
naming
- Renames `generatedMockObjectMetadataItems` to
`generateTestEnrichedObjectMetadataItemsMock` to make it clear this is
test-only enriched data
- Deletes `useLoadMockedObjectMetadataItems` hook (consolidated into
`useLoadMockedMinimalMetadata`)
- Ensures nothing destined for the metadata store computes
`readableFields`/`updatableFields` (preventing the localStorage bloat
from #18809)

## Type hierarchy (before → after)

**Before:**
```
ObjectMetadataItemsQuery → mapPaginated → ObjectMetadataItemWithRelated → enrich → ObjectMetadataItem
                                        → split → FlatObjectMetadataItem (store)
```

**After:**
```
ObjectMetadataItemsQuery → splitObjectMetadataGqlResponse → FlatObjectMetadataItem (store)
                         → mapPaginated + enrich (tests only) → EnrichedObjectMetadataItem
```

## Test plan

- [x] `npx nx typecheck twenty-front` passes
- [x] `npx nx test twenty-front` passes (767 suites, 4505 tests)
- [x] `npx nx lint twenty-front` passes
- [ ] CI checks pass


Made with [Cursor](https://cursor.com)
This commit is contained in:
Charles Bochet
2026-03-22 15:53:47 +01:00
committed by GitHub
parent 96c5728ed0
commit d5a7dec117
440 changed files with 1409 additions and 1285 deletions
@@ -2,7 +2,7 @@ import { t } from '@lingui/core/macro';
import { styled } from '@linaria/react';
import { useContext } from 'react';
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';
import {
IconBox,
OverflowingTextWithTooltip,
@@ -14,7 +14,7 @@ import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
export type SettingsDataModelObjectPreviewProps = {
className?: string;
objectMetadataItems: Pick<
ObjectMetadataItem,
EnrichedObjectMetadataItem,
'icon' | 'labelSingular' | 'labelPlural' | 'isCustom' | 'isRemote'
>[];
pluralizeLabel?: boolean;
@@ -55,7 +55,7 @@ const StyledSeparator = styled.div`
type SettingsDataModelObjectPreviewItemProps = {
objectMetadataItem: Pick<
ObjectMetadataItem,
EnrichedObjectMetadataItem,
'icon' | 'labelSingular' | 'labelPlural' | 'isCustom' | 'isRemote'
>;
pluralizeLabel: boolean;