mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 18:08:07 +08:00
fix: Fix null safety issues in workflow variable components
This commit is contained in:
@ -162,7 +162,7 @@ const VarReferencePicker: FC<Props> = ({
|
||||
const [open, setOpen] = useState(false)
|
||||
useEffect(() => {
|
||||
onOpen()
|
||||
}, [open])
|
||||
}, [open, onOpen])
|
||||
const hasValue = !isConstant && value.length > 0
|
||||
|
||||
const isIterationVar = useMemo(() => {
|
||||
@ -275,10 +275,12 @@ const VarReferencePicker: FC<Props> = ({
|
||||
return
|
||||
|
||||
const workflowContainer = document.getElementById('workflow-container')
|
||||
if (!workflowContainer)
|
||||
return
|
||||
const {
|
||||
clientWidth,
|
||||
clientHeight,
|
||||
} = workflowContainer!
|
||||
} = workflowContainer
|
||||
const {
|
||||
setViewport,
|
||||
} = reactflow
|
||||
|
||||
@ -31,7 +31,9 @@ export const useVariableAssigner = () => {
|
||||
const handleAssignVariableValueChange = useCallback((nodeId: string, value: ValueSelector, varDetail: Var, groupId?: string) => {
|
||||
const { getNodes } = store.getState()
|
||||
const nodes = getNodes()
|
||||
const node: Node<VariableAssignerNodeType> = nodes.find(node => node.id === nodeId)!
|
||||
const node = nodes.find(node => node.id === nodeId) as Node<VariableAssignerNodeType> | undefined
|
||||
if (!node)
|
||||
return
|
||||
|
||||
let payload
|
||||
if (groupId && groupId !== 'target') {
|
||||
|
||||
Reference in New Issue
Block a user