From 4c1b35dce0d42db7540d4c84461339822e968f7b Mon Sep 17 00:00:00 2001 From: Gian Espinosa <44116036+glespinosa@users.noreply.github.com> Date: Fri, 15 Mar 2024 05:50:38 +0800 Subject: [PATCH] fix : Content: No Fields Have Been Added Screen appears for Content Items that have fields (#2519) * Showing only "No fields have been added" for those without fields yet * Updating the ItemCreate to pass newlyfields and adjusting the withloader so once the withloader done , the fields are already rendered * remove redundancy of fields --- .../src/app/components/Editor/Editor.js | 3 ++- .../src/app/views/ItemCreate/ItemCreate.tsx | 13 ++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/apps/content-editor/src/app/components/Editor/Editor.js b/src/apps/content-editor/src/app/components/Editor/Editor.js index 1416531ad5..5d551f1360 100644 --- a/src/apps/content-editor/src/app/components/Editor/Editor.js +++ b/src/apps/content-editor/src/app/components/Editor/Editor.js @@ -13,11 +13,11 @@ import { ThemeProvider } from "@mui/material"; import { theme } from "@zesty-io/material"; import { Breadcrumbs } from "shell/components/global-tabs/components/Breadcrumbs"; import { Field } from "./Field"; -import { useGetContentModelFieldsQuery } from "../../../../../../shell/services/instance"; import { FieldError } from "./FieldError"; import styles from "./Editor.less"; import { cloneDeep } from "lodash"; +import { useGetContentModelFieldsQuery } from "../../../../../../shell/services/instance"; export const MaxLengths = { text: 150, @@ -207,6 +207,7 @@ export default memo(function Editor({ {saveClicked && hasErrors && ( )} + {activeFields.length ? ( activeFields.map((field) => { return ( diff --git a/src/apps/content-editor/src/app/views/ItemCreate/ItemCreate.tsx b/src/apps/content-editor/src/app/views/ItemCreate/ItemCreate.tsx index 89bd67bd9b..faffd2dbf7 100644 --- a/src/apps/content-editor/src/app/views/ItemCreate/ItemCreate.tsx +++ b/src/apps/content-editor/src/app/views/ItemCreate/ItemCreate.tsx @@ -27,6 +27,7 @@ import { AppState } from "../../../../../../shell/store/types"; import { useCreateItemPublishingMutation, useGetContentItemQuery, + useGetContentModelFieldsQuery, } from "../../../../../../shell/services/instance"; import { ScheduleFlyout } from "../ItemEdit/components/Header/ItemVersioning/ScheduleFlyout"; import { Error } from "../../components/Editor/Field/FieldShell"; @@ -85,6 +86,11 @@ export const ItemCreate = () => { skip: !newItemZUID, }); + const { + isSuccess: isSuccessNewModelFields, + isFetching: isFetchingNewModelFields, + } = useGetContentModelFieldsQuery(modelZUID); + // on mount and update modelZUID, load item fields useEffect(() => { loadItemFields(modelZUID); @@ -268,7 +274,12 @@ export const ItemCreate = () => { } return ( - +