From b3426e3f50316d872b1e2105c40ac9a19d4ebbb4 Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Thu, 3 Oct 2024 17:40:07 +0100 Subject: [PATCH] fix(frontend): add contentEntity normalization logic --- frontend/src/components/contents/index.tsx | 4 ++-- frontend/src/services/entities.ts | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/contents/index.tsx b/frontend/src/components/contents/index.tsx index c2c104b..227c931 100644 --- a/frontend/src/components/contents/index.tsx +++ b/frontend/src/components/contents/index.tsx @@ -165,8 +165,8 @@ export const Contents = () => { field: "entity", headerName: t("label.entity"), flex: 1, - valueGetter: (row: IContent) => { - const contentType = getEntityFromCache(row.id); + valueGetter: (entityId) => { + const contentType = getEntityFromCache(entityId); return contentType?.name; }, diff --git a/frontend/src/services/entities.ts b/frontend/src/services/entities.ts index ab6ebb2..7b54093 100644 --- a/frontend/src/services/entities.ts +++ b/frontend/src/services/entities.ts @@ -164,10 +164,14 @@ export const ContentTypeEntity = new schema.Entity( }, ); -export const ContentEntity = new schema.Entity(EntityType.CONTENT, undefined, { - idAttribute: ({ id }) => id, - processStrategy: processCommonStrategy, -}); +export const ContentEntity = new schema.Entity( + EntityType.CONTENT, + { entity: ContentTypeEntity }, + { + idAttribute: ({ id }) => id, + processStrategy: processCommonStrategy, + }, +); export const SettingEntity = new schema.Entity(EntityType.SETTING, { idAttribute: ({ id }) => id,