From a3be1fb10beaae374514b9bcc250ccb70a154b08 Mon Sep 17 00:00:00 2001 From: Leonardo Giacone Date: Tue, 30 Jul 2024 16:24:37 +0200 Subject: [PATCH 1/2] fix(app-headless-cms): pass defaultValue to nested multiple values --- .../src/admin/components/ContentEntryForm/useBind.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/app-headless-cms/src/admin/components/ContentEntryForm/useBind.tsx b/packages/app-headless-cms/src/admin/components/ContentEntryForm/useBind.tsx index 0b4065a1ba5..9fdf9540e52 100644 --- a/packages/app-headless-cms/src/admin/components/ContentEntryForm/useBind.tsx +++ b/packages/app-headless-cms/src/admin/components/ContentEntryForm/useBind.tsx @@ -38,7 +38,7 @@ export function useBind({ Bind, field }: UseBindProps) { return useCallback( (index = -1) => { - const { parentName } = Bind; + const { parentName, displayName } = Bind; // If there's a parent name assigned to the given Bind component, we need to include it in the new field "name". // This allows us to have nested fields (like "object" field with nested properties) @@ -46,6 +46,13 @@ export function useBind({ Bind, field }: UseBindProps) { .filter(v => v !== undefined) .join("."); + console.log("=========== START ==========="); + console.log("displayName", displayName); + console.log("parentName", parentName); + console.log("name", name); + console.log("index", index); + console.log("=========== END ==========="); + const componentId = `${name};${cacheKey}`; if (memoizedBindComponents.current[componentId]) { @@ -69,7 +76,7 @@ export function useBind({ Bind, field }: UseBindProps) { {bind => { // Multiple-values functions below. From ee3be7646102108f3ffff5b30a00fbc1d75a836f Mon Sep 17 00:00:00 2001 From: Leonardo Giacone Date: Tue, 30 Jul 2024 18:19:49 +0200 Subject: [PATCH 2/2] chore(app-headless-cms): remove logs --- .../src/admin/components/ContentEntryForm/useBind.tsx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/packages/app-headless-cms/src/admin/components/ContentEntryForm/useBind.tsx b/packages/app-headless-cms/src/admin/components/ContentEntryForm/useBind.tsx index 9fdf9540e52..6a44f533707 100644 --- a/packages/app-headless-cms/src/admin/components/ContentEntryForm/useBind.tsx +++ b/packages/app-headless-cms/src/admin/components/ContentEntryForm/useBind.tsx @@ -38,7 +38,7 @@ export function useBind({ Bind, field }: UseBindProps) { return useCallback( (index = -1) => { - const { parentName, displayName } = Bind; + const { parentName } = Bind; // If there's a parent name assigned to the given Bind component, we need to include it in the new field "name". // This allows us to have nested fields (like "object" field with nested properties) @@ -46,13 +46,6 @@ export function useBind({ Bind, field }: UseBindProps) { .filter(v => v !== undefined) .join("."); - console.log("=========== START ==========="); - console.log("displayName", displayName); - console.log("parentName", parentName); - console.log("name", name); - console.log("index", index); - console.log("=========== END ==========="); - const componentId = `${name};${cacheKey}`; if (memoizedBindComponents.current[componentId]) {