浏览代码

fix: start node input config modal raise 'variable name is required' (#8793)

tags/0.9.0
非法操作 1年前
父节点
当前提交
62406991df
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. 8
    2
      web/app/components/app/configuration/config-var/config-modal/index.tsx

+ 8
- 2
web/app/components/app/configuration/config-var/config-modal/index.tsx 查看文件

@@ -1,6 +1,6 @@
'use client'
import type { FC } from 'react'
import React, { useCallback, useState } from 'react'
import React, { useCallback, useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useContext } from 'use-context-selector'
import ModalFoot from '../modal-foot'
@@ -40,6 +40,12 @@ const ConfigModal: FC<IConfigModalProps> = ({
const { t } = useTranslation()
const [tempPayload, setTempPayload] = useState<InputVar>(payload || getNewVarInWorkflow('') as any)
const { type, label, variable, options, max_length } = tempPayload
const modalRef = useRef<HTMLDivElement>(null)
useEffect(() => {
// To fix the first input element auto focus, then directly close modal will raise error
if (isShow)
modalRef.current?.focus()
}, [isShow])

const isStringInput = type === InputVarType.textInput || type === InputVarType.paragraph
const checkVariableName = useCallback((value: string) => {
@@ -135,7 +141,7 @@ const ConfigModal: FC<IConfigModalProps> = ({
isShow={isShow}
onClose={onClose}
>
<div className='mb-8'>
<div className='mb-8' ref={modalRef} tabIndex={-1}>
<div className='space-y-2'>

<Field title={t('appDebug.variableConfig.fieldType')}>

正在加载...
取消
保存