Skip to content

Commit d32601d

Browse files
authored
Fix admin UI crashes (#5195)
1 parent c9aba85 commit d32601d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • packages/apostrophe/modules/@apostrophecms/doc-type/ui/apos/components

‎packages/apostrophe/modules/@apostrophecms/doc-type/ui/apos/components/AposDocEditor.vue‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,7 @@ export default {
567567
}
568568
569569
if (field.type === 'select' || field.type === 'radio') {
570+
// WARNING: field choices might be a string (dynamic choices)
570571
const validChoices = field.choices.map(choice => choice.value);
571572
572573
if (!validChoices.includes(object[field.name])) {
@@ -579,12 +580,13 @@ export default {
579580
}
580581
581582
if (field.type === 'checkboxes') {
583+
// WARNING: field choices might be a string (dynamic choices)
582584
const validChoices = field.choices.map(choice => choice.value);
583585
584586
const filteredValues = object[field.name]
585-
.filter(value => validChoices.includes(value));
587+
?.filter(value => validChoices.includes(value));
586588
587-
if (filteredValues.length) {
589+
if (filteredValues?.length) {
588590
object[field.name] = filteredValues;
589591
continue;
590592
}

0 commit comments

Comments
 (0)