From 86e88d998fbc36d7ea2456dfbc685edadff107d3 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 19 Oct 2021 10:31:59 -0400 Subject: [PATCH] fix: #338, array / block fields with only nested array block fields break admin UI --- src/admin/components/forms/Form/fieldReducer.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/admin/components/forms/Form/fieldReducer.ts b/src/admin/components/forms/Form/fieldReducer.ts index 0e8f9d79cc..8180a6d4b6 100644 --- a/src/admin/components/forms/Form/fieldReducer.ts +++ b/src/admin/components/forms/Form/fieldReducer.ts @@ -95,8 +95,11 @@ function fieldReducer(state: Fields, action): Fields { }; } - // Add new object containing subfield names to unflattenedRows array - unflattenedRows.splice(rowIndex + 1, 0, subFieldState); + // If there are subfields + if (Object.keys(subFieldState).length > 0) { + // Add new object containing subfield names to unflattenedRows array + unflattenedRows.splice(rowIndex + 1, 0, subFieldState); + } const newState = { ...remainingFlattenedState,