From 47ab3c971e4aafec443e8b4d73e7c921dec38ac6 Mon Sep 17 00:00:00 2001 From: Sagar Choudhary Date: Fri, 20 Oct 2023 14:45:14 +0400 Subject: [PATCH] fix: ensure array fields can render if value is undefined --- .../core/components/InputOrGroup/fields/ArrayField/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/components/InputOrGroup/fields/ArrayField/index.tsx b/packages/core/components/InputOrGroup/fields/ArrayField/index.tsx index 2ae4798ed4..7fa76d45ed 100644 --- a/packages/core/components/InputOrGroup/fields/ArrayField/index.tsx +++ b/packages/core/components/InputOrGroup/fields/ArrayField/index.tsx @@ -30,7 +30,7 @@ export const ArrayField = ({ const { state, setUi } = useAppContext(); const arrayState: ArrayState = state.ui.arrayState[arrayFieldId] || { - items: Array.from(value).map((v) => ({ + items: Array.from(value || []).map((v) => ({ _arrayId: generateId("ArrayItem"), data: v, })), @@ -54,7 +54,7 @@ export const ArrayField = ({ // Create a mirror of value with IDs added for drag and drop useEffect(() => { - const newItems = Array.from(value).map((item, idx) => ({ + const newItems = Array.from(value || []).map((item, idx) => ({ _arrayId: arrayState.items[idx]?._arrayId || generateId("ArrayItem"), data: item, }));