example of remove useEffect (#25212)

This commit is contained in:
Asuka Minato 2025-09-05 18:35:59 +09:00 committed by GitHub
parent d03d3518d7
commit a9da8edbde
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -60,14 +60,11 @@ const ValueContent = ({
const [fileValue, setFileValue] = useState<any>(formatFileValue(currentVar))
const { run: debounceValueChange } = useDebounceFn(handleValueChange, { wait: 500 })
// update default value when id changed
useEffect(() => {
if (showTextEditor) {
if (currentVar.value_type === 'number')
return setValue(JSON.stringify(currentVar.value))
setValue(JSON.stringify(currentVar.value))
if (!currentVar.value)
return setValue('')
setValue('')
setValue(currentVar.value)
}
if (showJSONEditor)
@ -75,7 +72,6 @@ const ValueContent = ({
if (showFileEditor)
setFileValue(formatFileValue(currentVar))
}, [currentVar.id, currentVar.value])
const handleTextChange = (value: string) => {
if (currentVar.value_type === 'string')