From 20c4633d2a9ae0d0bf260254c63588f5edb2c9fe Mon Sep 17 00:00:00 2001 From: Yi Xiao <54782454+YIXIAO0@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:59:59 +0800 Subject: [PATCH] fix: empty object (conversation variable) editable (#11352) --- .../panel/chat-variable-panel/components/variable-modal.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx b/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx index 2118894cc7dec7..baa42eef24f59b 100644 --- a/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx +++ b/web/app/components/workflow/panel/chat-variable-panel/components/variable-modal.tsx @@ -97,8 +97,9 @@ const ChatVariableModal = ({ return objectPlaceholder }, [type]) const getObjectValue = useCallback(() => { - if (!chatVar) + if (!chatVar || Object.keys(chatVar.value).length === 0) return [DEFAULT_OBJECT_VALUE] + return Object.keys(chatVar.value).map((key) => { return { key,