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 GitHub
parent c85c87f3da
commit 9c01d3e775
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -12,7 +12,10 @@ const AddField = () => {
const handleAddField = useCallback(() => { const handleAddField = useCallback(() => {
setIsAddingNewField(true) 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]) }, [setIsAddingNewField, emit])
return ( return (

View File

@ -122,7 +122,8 @@ const EditCard: FC<EditCardProps> = ({
}, [emit, path, parentPath, fields, currentFields]) }, [emit, path, parentPath, fields, currentFields])
const handlePropertyNameChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => { 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(() => { const handlePropertyNameBlur = useCallback(() => {