From 9c01d3e775e35162e9ba1cdd10eb4b40160dc446 Mon Sep 17 00:00:00 2001 From: vicen <49907687+dingweichen@users.noreply.github.com> Date: Tue, 4 Nov 2025 09:45:28 +0800 Subject: [PATCH] fix: two web bugs for json-schema-config-modal (#27718) --- .../json-schema-config-modal/visual-editor/add-field.tsx | 5 ++++- .../visual-editor/edit-card/index.tsx | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/add-field.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/add-field.tsx index ab28233841..eba94e85dd 100644 --- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/add-field.tsx +++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/add-field.tsx @@ -12,7 +12,10 @@ const AddField = () => { const handleAddField = useCallback(() => { setIsAddingNewField(true) - emit('addField', { path: [] }) + // fix: when user change the last property type, the 'hoveringProperty' value will be reset by 'setHoveringPropertyDebounced(null)', that cause the EditCard not showing + setTimeout(() => { + emit('addField', { path: [] }) + }, 100) }, [setIsAddingNewField, emit]) return ( diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/index.tsx b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/index.tsx index 4aa0f99d3f..2733fcc11f 100644 --- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/index.tsx +++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/edit-card/index.tsx @@ -122,7 +122,8 @@ const EditCard: FC = ({ }, [emit, path, parentPath, fields, currentFields]) const handlePropertyNameChange = useCallback((e: React.ChangeEvent) => { - setCurrentFields(prev => ({ ...prev, name: e.target.value })) + // fix: when user add name contains space, the variable reference will not work + setCurrentFields(prev => ({ ...prev, name: e.target.value?.trim() })) }, []) const handlePropertyNameBlur = useCallback(() => {