From 183d273de247f951c775b350f962efb23bb459c9 Mon Sep 17 00:00:00 2001 From: ryanwong Date: Mon, 18 Nov 2024 13:32:19 -0500 Subject: [PATCH] fixed the issue --- src/components/ConfigPanel.tsx | 38 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/components/ConfigPanel.tsx b/src/components/ConfigPanel.tsx index 1002bcc..b30fc13 100644 --- a/src/components/ConfigPanel.tsx +++ b/src/components/ConfigPanel.tsx @@ -148,7 +148,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) { value: string, arrayName: string ) => { - const array = [...(node.data[arrayName] || [])]; + const array = [...node.data[arrayName]]; array[index] = { ...array[index], [field]: value }; const newData = { ...node.data, @@ -163,7 +163,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) { const fieldToAdd = arrayName === "queryFields" ? newQueryField : newField; if (!fieldToAdd.name.trim()) return; - const array = [...(node.data[arrayName] || []), { ...fieldToAdd }]; + const array = [...node.data[arrayName], { ...fieldToAdd }]; const newData = { ...node.data, [arrayName]: array, @@ -181,7 +181,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) { }; const removeField = (index: number, arrayName: string) => { - const array = [...(node.data[arrayName] || [])]; + const array = [...node.data[arrayName]]; array.splice(index, 1); const newData = { ...node.data, @@ -212,7 +212,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) { @@ -241,7 +241,7 @@ export function ConfigPanel({ node, onClose, onUpdateNode }: ConfigPanelProps) {