fix(plugin-workflow): fix manual node drawer (#1653)
This commit is contained in:
parent
6f12e97f52
commit
7a4f2a011b
@ -97,6 +97,9 @@ export function useNodeContext() {
|
||||
|
||||
export function useAvailableUpstreams(node) {
|
||||
const stack: any[] = [];
|
||||
if (!node) {
|
||||
return [];
|
||||
}
|
||||
for (let current = node.upstream; current; current = current.upstream) {
|
||||
stack.push(current);
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ function useFlowRecordFromBlock(opts) {
|
||||
|
||||
function FlowContextProvider(props) {
|
||||
const api = useAPIClient();
|
||||
const { node, executionId } = useRecord();
|
||||
const { id, node, executionId } = useRecord();
|
||||
const [flowContext, setFlowContext] = useState<any>(null);
|
||||
|
||||
useEffect(() => {
|
||||
@ -393,7 +393,7 @@ function FlowContextProvider(props) {
|
||||
.then(({ data }) => {
|
||||
const {
|
||||
workflow: { nodes = [], ...workflow } = {},
|
||||
...execution
|
||||
execution
|
||||
} = data?.data ?? {};
|
||||
linkNodes(nodes);
|
||||
setFlowContext({
|
||||
@ -402,14 +402,14 @@ function FlowContextProvider(props) {
|
||||
execution
|
||||
});
|
||||
});
|
||||
}, [executionId]);
|
||||
}, [id]);
|
||||
|
||||
if (!flowContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const nodes = useAvailableUpstreams(flowContext.nodes.find(item => item.id === node.id));
|
||||
const nodeComponents = nodes.reduce((components, { type }) => Object.assign(components, instructions.get(type).components), {});
|
||||
const upstreams = useAvailableUpstreams(flowContext.nodes.find(item => item.id === node.id));
|
||||
const nodeComponents = upstreams.reduce((components, { type }) => Object.assign(components, instructions.get(type).components), {});
|
||||
|
||||
return (
|
||||
<FlowContext.Provider value={flowContext}>
|
||||
|
Loading…
Reference in New Issue
Block a user