This commit is contained in:
StyleZhang
2024-03-13 16:59:28 +08:00
parent 2edef89a8d
commit e11fc8c131
5 changed files with 24 additions and 5 deletions

View File

@ -1,6 +1,7 @@
import type { MouseEvent } from 'react'
import {
useCallback,
useEffect,
useState,
} from 'react'
import type { NodeProps } from 'reactflow'
@ -15,6 +16,7 @@ import type { Node } from '../../../types'
import BlockSelector from '../../../block-selector'
import type { ToolDefaultValue } from '../../../block-selector/types'
import { useNodesInteractions } from '../../../hooks'
import { useStore } from '../../../store'
type NodeHandleProps = {
handleId: string
@ -87,10 +89,12 @@ export const NodeTargetHandle = ({
export const NodeSourceHandle = ({
id,
data,
handleId,
handleClassName,
nodeSelectorClassName,
}: NodeHandleProps) => {
const notInitialWorkflow = useStore(s => s.notInitialWorkflow)
const [open, setOpen] = useState(false)
const { handleNodeAddNext } = useNodesInteractions()
const edges = useEdges()
@ -108,6 +112,11 @@ export const NodeSourceHandle = ({
handleNodeAddNext(id, type, handleId, toolDefaultValue)
}, [handleNodeAddNext, id, handleId])
useEffect(() => {
if (notInitialWorkflow && data.type === BlockEnum.Start)
setOpen(true)
}, [notInitialWorkflow, data.type])
return (
<>
<Handle