diff --git a/client/components/planning-editor-standalone/field-adapters/custom-vocabularies.ts b/client/components/planning-editor-standalone/field-adapters/custom-vocabularies.ts index 1bb5da8af..053b94189 100644 --- a/client/components/planning-editor-standalone/field-adapters/custom-vocabularies.ts +++ b/client/components/planning-editor-standalone/field-adapters/custom-vocabularies.ts @@ -47,7 +47,7 @@ export const getCustomVocabularyFields = () => { })); // Remove values that don't match the "subfield" ID, so there's no item duplication - const restOfValues = item.subject.filter((x) => x.scheme !== id); + const restOfValues = (item.subject ?? []).filter((x) => x.scheme !== id); return { ...item, diff --git a/client/components/planning-editor-standalone/profile-converter.ts b/client/components/planning-editor-standalone/profile-converter.ts index 0484760d1..36c6ebba0 100644 --- a/client/components/planning-editor-standalone/profile-converter.ts +++ b/client/components/planning-editor-standalone/profile-converter.ts @@ -17,7 +17,7 @@ type IFieldConverted = IBaseField<'normal'> | ICustomVocabularyField; export const getProfileFieldsConverted = (): Array => { const planningProfile = planningApi.contentProfiles.get('planning'); const planningGroups = getEditorFormGroupsFromProfile(planningProfile); - const planningFieldIds = flatMap(Object.values(planningGroups).map((x) => x.fields)); + const planningFieldIds = Object.values(planningGroups).flatMap((x) => x.fields); const convertedFieldIds: Array = []; for (const fieldId of planningFieldIds) {