Skip to content

Commit 1c044e6

Browse files
committed
feat: Update node execution state management to give immediate visual indication of running workflow
1 parent be1e044 commit 1c044e6

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

apps/web/src/components/workflow/workflow-builder.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { WorkflowProvider } from "./workflow-context";
2424
import { WorkflowNodeSelector } from "./workflow-node-selector";
2525
import { WorkflowSidebar } from "./workflow-sidebar";
2626
import type {
27+
NodeExecutionState,
2728
NodeType,
2829
WorkflowEdgeType,
2930
WorkflowExecution,
@@ -225,10 +226,10 @@ export function WorkflowBuilder({
225226
}
226227
}, [initialWorkflowExecution, nodes, updateNodeData]);
227228

228-
const resetNodeStates = useCallback(() => {
229+
const resetNodeStates = useCallback((state: NodeExecutionState = "idle") => {
229230
nodes.forEach((node) => {
230231
updateNodeExecution(node.id, {
231-
state: "idle",
232+
state,
232233
outputs: {},
233234
error: undefined,
234235
});
@@ -239,7 +240,7 @@ export function WorkflowBuilder({
239240
const handleExecute = useCallback(() => {
240241
if (!executeWorkflow) return null;
241242

242-
resetNodeStates();
243+
resetNodeStates("executing");
243244
setWorkflowStatus("executing"); // Local immediate update
244245

245246
return executeWorkflow(workflowId, (execution: WorkflowExecution) => {

0 commit comments

Comments
 (0)