Explorar el Código

Revert "example of remove useEffect" (#25418)

tags/1.9.0
crazywoola hace 1 mes
padre
commit
eb52216a9c
No account linked to committer's email address
Se han modificado 1 ficheros con 15 adiciones y 11 borrados
  1. 15
    11
      web/app/components/workflow/variable-inspect/value-content.tsx

+ 15
- 11
web/app/components/workflow/variable-inspect/value-content.tsx Ver fichero

const [fileValue, setFileValue] = useState<any>(formatFileValue(currentVar)) const [fileValue, setFileValue] = useState<any>(formatFileValue(currentVar))


const { run: debounceValueChange } = useDebounceFn(handleValueChange, { wait: 500 }) const { run: debounceValueChange } = useDebounceFn(handleValueChange, { wait: 500 })
if (showTextEditor) {
if (currentVar.value_type === 'number')
setValue(JSON.stringify(currentVar.value))
if (!currentVar.value)
setValue('')
setValue(currentVar.value)
}
if (showJSONEditor)
setJson(currentVar.value ? JSON.stringify(currentVar.value, null, 2) : '')


if (showFileEditor)
setFileValue(formatFileValue(currentVar))
// update default value when id changed
useEffect(() => {
if (showTextEditor) {
if (currentVar.value_type === 'number')
return setValue(JSON.stringify(currentVar.value))
if (!currentVar.value)
return setValue('')
setValue(currentVar.value)
}
if (showJSONEditor)
setJson(currentVar.value ? JSON.stringify(currentVar.value, null, 2) : '')

if (showFileEditor)
setFileValue(formatFileValue(currentVar))
}, [currentVar.id, currentVar.value])


const handleTextChange = (value: string) => { const handleTextChange = (value: string) => {
if (currentVar.value_type === 'string') if (currentVar.value_type === 'string')

Cargando…
Cancelar
Guardar