diff --git a/service-web/client/src/components/flow/node/LoopNode.tsx b/service-web/client/src/components/flow/node/LoopNode.tsx index 7992236..57a5daa 100644 --- a/service-web/client/src/components/flow/node/LoopNode.tsx +++ b/service-web/client/src/components/flow/node/LoopNode.tsx @@ -1,17 +1,37 @@ import {Background, BackgroundVariant, type NodeProps} from '@xyflow/react' import {classnames} from 'amis' -import React from 'react' -import {flowBackgroundColor, flowDotColor} from '../types.ts' -import AmisNode, {nodeClassName, NormalNodeHandler} from './AmisNode.tsx' +import React, {useCallback, useEffect} from 'react' import AddNodeButton from '../component/AddNodeButton.tsx' +import {useDataStore} from '../store/DataStore.ts' +import {flowBackgroundColor, flowDotColor} from '../types.ts' +import AmisNode, {nodeClassName, NormalNodeHandler, outputsFormColumns} from './AmisNode.tsx' const LoopNode = (props: NodeProps) => { + const {mergeDataById} = useDataStore() + + useEffect(() => { + mergeDataById( + props.id, + { + outputs: { + output: { + type: 'array-object', + }, + }, + }, + ) + }, [props.id]) + + const columnsSchema = useCallback(() => [ + ...outputsFormColumns(false, true), + ], [props.id]) + return ( { } + columnSchema={columnsSchema} handler={} resize={{ minWidth: 350,