Skip to content

Commit 2f504ce

Browse files
committed
Fix
1 parent f55f6cc commit 2f504ce

File tree

4 files changed

+26
-12
lines changed

4 files changed

+26
-12
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/action-bar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ export const ActionBar = memo(
168168
</Tooltip.Trigger>
169169
<Tooltip.Content side='top'>
170170
{(() => {
171-
if (disabled) return getTooltipMessage('Run from this block')
171+
if (disabled) return getTooltipMessage('Run from block')
172172
if (isExecuting) return 'Execution in progress'
173173
if (isInsideSubflow) return 'Cannot run from inside subflow'
174174
if (!dependenciesSatisfied) return 'Run upstream blocks first'
175-
return 'Run from this block'
175+
return 'Run from block'
176176
})()}
177177
</Tooltip.Content>
178178
</Tooltip.Root>

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/block-menu/block-menu.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ export interface BlockMenuProps {
4646
showRemoveFromSubflow?: boolean
4747
/** Whether run from block is available (has snapshot, was executed, not inside subflow) */
4848
canRunFromBlock?: boolean
49-
/** Reason why run from block is disabled (for tooltip) */
50-
runFromBlockDisabledReason?: string
5149
disableEdit?: boolean
5250
isExecuting?: boolean
5351
}
@@ -77,7 +75,6 @@ export function BlockMenu({
7775
hasClipboard = false,
7876
showRemoveFromSubflow = false,
7977
canRunFromBlock = false,
80-
runFromBlockDisabledReason,
8178
disableEdit = false,
8279
isExecuting = false,
8380
}: BlockMenuProps) {
@@ -228,11 +225,7 @@ export function BlockMenu({
228225
}
229226
}}
230227
>
231-
{isExecuting
232-
? 'Execution in progress...'
233-
: !canRunFromBlock && runFromBlockDisabledReason
234-
? runFromBlockDisabledReason
235-
: 'Run from this block'}
228+
Run from block
236229
</PopoverItem>
237230
<PopoverItem
238231
disabled={isExecuting}
@@ -243,7 +236,7 @@ export function BlockMenu({
243236
}
244237
}}
245238
>
246-
{isExecuting ? 'Execution in progress...' : 'Run until this block'}
239+
Run until block
247240
</PopoverItem>
248241
</>
249242
)}

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { subscriptionKeys } from '@/hooks/queries/subscription'
2323
import { useExecutionStream } from '@/hooks/use-execution-stream'
2424
import { WorkflowValidationError } from '@/serializer'
2525
import { useExecutionStore } from '@/stores/execution'
26+
import { useNotificationStore } from '@/stores/notifications'
2627
import { useVariablesStore } from '@/stores/panel'
2728
import { useEnvironmentStore } from '@/stores/settings/environment'
2829
import { type ConsoleEntry, useTerminalConsoleStore } from '@/stores/terminal'
@@ -101,11 +102,13 @@ export function useWorkflowExecution() {
101102
setEdgeRunStatus,
102103
setLastExecutionSnapshot,
103104
getLastExecutionSnapshot,
105+
clearLastExecutionSnapshot,
104106
} = useExecutionStore()
105107
const [executionResult, setExecutionResult] = useState<ExecutionResult | null>(null)
106108
const executionStream = useExecutionStream()
107109
const currentChatExecutionIdRef = useRef<string | null>(null)
108110
const isViewingDiff = useWorkflowDiffStore((state) => state.isShowingDiff)
111+
const addNotification = useNotificationStore((state) => state.addNotification)
109112

110113
/**
111114
* Validates debug state before performing debug operations
@@ -1620,6 +1623,23 @@ export function useWorkflowExecution() {
16201623

16211624
onExecutionError: (data) => {
16221625
logger.error('Run-from-block execution error:', data.error)
1626+
1627+
// If block not found, the snapshot is stale - clear it
1628+
if (data.error?.includes('Block not found in workflow')) {
1629+
clearLastExecutionSnapshot(workflowId)
1630+
addNotification({
1631+
level: 'info',
1632+
message: 'Workflow was modified. Run the workflow again to refresh.',
1633+
workflowId,
1634+
})
1635+
logger.info('Cleared stale execution snapshot', { workflowId })
1636+
} else {
1637+
addNotification({
1638+
level: 'error',
1639+
message: data.error || 'Run from block failed',
1640+
workflowId,
1641+
})
1642+
}
16231643
},
16241644

16251645
onExecutionCancelled: () => {
@@ -1639,10 +1659,12 @@ export function useWorkflowExecution() {
16391659
[
16401660
getLastExecutionSnapshot,
16411661
setLastExecutionSnapshot,
1662+
clearLastExecutionSnapshot,
16421663
setIsExecuting,
16431664
setActiveBlocks,
16441665
setBlockRunStatus,
16451666
setEdgeRunStatus,
1667+
addNotification,
16461668
addConsole,
16471669
executionStream,
16481670
]

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3356,7 +3356,6 @@ const WorkflowContent = React.memo(() => {
33563356
(b) => b.parentId && (b.parentType === 'loop' || b.parentType === 'parallel')
33573357
)}
33583358
canRunFromBlock={runFromBlockState.canRun}
3359-
runFromBlockDisabledReason={runFromBlockState.reason}
33603359
disableEdit={!effectivePermissions.canEdit}
33613360
isExecuting={isExecuting}
33623361
/>

0 commit comments

Comments
 (0)