fix: display nested components in edit view (#19160)

* add nested component in getstarted dz

* fix: display nested components in edit view

* chore: add comment
This commit is contained in:
Rémi de Juvigny 2024-01-05 14:50:10 +01:00 committed by GitHub
parent f6ae15bd8b
commit 25d2a8ffa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -89,7 +89,7 @@
}, },
"dynamiczone": { "dynamiczone": {
"type": "dynamiczone", "type": "dynamiczone",
"components": ["basic.simple", "blog.test-como"] "components": ["basic.simple", "blog.test-como", "default.closingperiod"]
}, },
"one_way_tag": { "one_way_tag": {
"type": "relation", "type": "relation",

View File

@ -7,7 +7,7 @@ import {
useCMEditViewDataManager, useCMEditViewDataManager,
} from '@strapi/helper-plugin'; } from '@strapi/helper-plugin';
import { Trash } from '@strapi/icons'; import { Trash } from '@strapi/icons';
import size from 'lodash/size'; import { get, size } from 'lodash/fp';
import { useIntl } from 'react-intl'; import { useIntl } from 'react-intl';
import styled from 'styled-components'; import styled from 'styled-components';
@ -67,7 +67,8 @@ const FieldComponent = ({
const allowedFields = isCreatingEntry ? createActionAllowedFields : updateActionAllowedFields; const allowedFields = isCreatingEntry ? createActionAllowedFields : updateActionAllowedFields;
const componentValue = modifiedData[name] ?? null; // Use lodash get since the name can be a nested path (e.g. "component.1.component")
const componentValue = get(name, modifiedData) ?? null;
const compoName = getFieldName(name); const compoName = getFieldName(name);
const hasChildrenAllowedFields = React.useMemo(() => { const hasChildrenAllowedFields = React.useMemo(() => {