Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: two web bugs for json-schema-config-modal (#27718)

vicen9c01d3e775e3
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 ab282338413..eba94e85dd6 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 4aa0f99d3f1..2733fcc11f4 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<EditCardProps> = ({
}, [emit, path, parentPath, fields, currentFields])
const handlePropertyNameChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
- 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(() => {