Skip to content

Commit

Permalink
Fix: Delete previous node errors on successful node execution
Browse files Browse the repository at this point in the history
  • Loading branch information
mahesh-gfx committed Aug 20, 2024
1 parent cde4b06 commit 7366333
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/frontend/src/context/WorkflowContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,18 @@ const WorkflowProvider = ({ children }: any) => {
[data.nodeId]: data.output,
}));

// Update the node data with the execution result
// Update the node data with the execution result and remove the error property
setNodes((nds) =>
nds.map((node) =>
node.id === data.nodeId
? { ...node, data: { ...node.data, output: data.output } }
: node
)
nds.map((node) => {
if (node.id === data.nodeId) {
const { error, ...restData } = node.data; // Destructure to remove 'error'
return {
...node,
data: { ...restData, output: data.output }, // Use the rest of the data without 'error'
};
}
return node;
})
);
};

Expand Down Expand Up @@ -394,6 +399,7 @@ const WorkflowProvider = ({ children }: any) => {
};
try {
setExecutionResults([]); // Reset results before starting new execution
setExecutionErrors([]);
setIsExecuting(true);
setExecutionStatus("Executing workflow...");
console.log("Executionresults: ", executionResults);
Expand Down

0 comments on commit 7366333

Please sign in to comment.