fix(richtext-*): extra fields not being iterated correctly (#3693)

This commit is contained in:
Alessio Gravili
2023-10-16 18:47:52 +02:00
committed by GitHub
parent 2e6a2c8355
commit b8a58666e7
2 changed files with 8 additions and 4 deletions

View File

@@ -64,7 +64,9 @@ export function transformExtraFields(
// Wrap fields which are not part of the base schema in a group named 'fields' - otherwise they will be rendered but not saved
const extraFields = []
fields.forEach((field) => {
for (let i = fields.length - 1; i >= 0; i--) {
const field = fields[i]
if ('name' in field) {
if (
!baseFields.find((baseField) => !('name' in baseField) || baseField.name === field.name)
@@ -76,7 +78,7 @@ export function transformExtraFields(
}
}
}
})
}
if (Array.isArray(customFieldSchema) || fields.length > 0) {
fields.push({