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

This commit is contained in:
vicen 2025-11-04 09:45:28 +08:00 committed by CodingOnStar
parent 40a68c9068
commit fd14f8ee12
2 changed files with 6 additions and 2 deletions

View File

@ -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 (

View File

@ -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(() => {