fix: Fix null safety issues in workflow variable components

This commit is contained in:
zhsama
2026-01-31 21:26:32 +08:00
parent d353feb172
commit 4d82769baa
3 changed files with 57 additions and 29 deletions

View File

@ -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

View File

@ -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') {