From a9f271cdb03efa1d90baa997ce6d641eaf7a9f94 Mon Sep 17 00:00:00 2001 From: Siddharth Ganesan Date: Tue, 27 Jan 2026 20:04:53 -0800 Subject: [PATCH] I think it works?? --- .../components/action-bar/action-bar.tsx | 15 ++++++++--- .../components/block-menu/block-menu.tsx | 7 ++++- .../hooks/use-workflow-execution.ts | 25 +++++++++++++++--- .../[workspaceId]/w/[workflowId]/workflow.tsx | 26 +++++++++---------- apps/sim/executor/dag/builder.ts | 19 +++++++++----- apps/sim/executor/dag/construction/paths.ts | 11 +++++++- apps/sim/executor/execution/executor.ts | 10 ++++--- apps/sim/executor/utils/run-from-block.ts | 4 +++ 8 files changed, 85 insertions(+), 32 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/action-bar.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/action-bar.tsx index e016918a1..dddeb126a 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/action-bar.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/action-bar.tsx @@ -114,9 +114,17 @@ export const ActionBar = memo( const snapshot = activeWorkflowId ? getLastExecutionSnapshot(activeWorkflowId) : null const incomingEdges = edges.filter((edge) => edge.target === blockId) const isTriggerBlock = incomingEdges.length === 0 + + // Check if each source block is either executed OR is a trigger block (triggers don't need prior execution) + const isSourceSatisfied = (sourceId: string) => { + if (snapshot?.executedBlocks.includes(sourceId)) return true + // Check if source is a trigger (has no incoming edges itself) + const sourceIncomingEdges = edges.filter((edge) => edge.target === sourceId) + return sourceIncomingEdges.length === 0 + } + const dependenciesSatisfied = - isTriggerBlock || - (snapshot && incomingEdges.every((edge) => snapshot.executedBlocks.includes(edge.source))) + isTriggerBlock || incomingEdges.every((edge) => isSourceSatisfied(edge.source)) const canRunFromBlock = dependenciesSatisfied && !isNoteBlock && !isInsideSubflow && !isExecuting @@ -149,7 +157,7 @@ export const ActionBar = memo( 'dark:border-transparent dark:bg-[var(--surface-4)]' )} > - {!isNoteBlock && ( + {!isNoteBlock && !isInsideSubflow && (