From 5f8f9f7a61b366e985e5c9e2904f810e330d888a Mon Sep 17 00:00:00 2001 From: Alessio Gravili Date: Sun, 24 Nov 2024 21:52:47 -0700 Subject: [PATCH] fix: hidden or disabled fields were included in clientConfig --- packages/payload/src/fields/config/client.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/payload/src/fields/config/client.ts b/packages/payload/src/fields/config/client.ts index 2d9612e59b..0f7ab993d4 100644 --- a/packages/payload/src/fields/config/client.ts +++ b/packages/payload/src/fields/config/client.ts @@ -79,7 +79,7 @@ export const createClientField = ({ const disabledFromAdmin = incomingField?.admin && 'disabled' in incomingField.admin && incomingField.admin.disabled - if (fieldAffectsData(clientField) && (isHidden || disabledFromAdmin)) { + if (fieldAffectsData(incomingField) && (isHidden || disabledFromAdmin)) { return null } @@ -308,7 +308,7 @@ export const createClientFields = ({ i18n: I18nClient importMap: ImportMap }): ClientField[] => { - const clientFields: ClientField[] = new Array(fields.length) + const clientFields: ClientField[] = [] for (let i = 0; i < fields.length; i++) { const field = fields[i] @@ -321,7 +321,7 @@ export const createClientFields = ({ }) if (clientField) { - clientFields[i] = clientField + clientFields.push(clientField) } }