This commit is contained in:
Siddharth Ganesan
2026-01-27 14:55:07 -08:00
parent f55f6cc453
commit 2f504ce07e
4 changed files with 26 additions and 12 deletions

View File

@@ -168,11 +168,11 @@ export const ActionBar = memo(
</Tooltip.Trigger>
<Tooltip.Content side='top'>
{(() => {
if (disabled) return getTooltipMessage('Run from this block')
if (disabled) return getTooltipMessage('Run from block')
if (isExecuting) return 'Execution in progress'
if (isInsideSubflow) return 'Cannot run from inside subflow'
if (!dependenciesSatisfied) return 'Run upstream blocks first'
return 'Run from this block'
return 'Run from block'
})()}
</Tooltip.Content>
</Tooltip.Root>

View File

@@ -46,8 +46,6 @@ export interface BlockMenuProps {
showRemoveFromSubflow?: boolean
/** Whether run from block is available (has snapshot, was executed, not inside subflow) */
canRunFromBlock?: boolean
/** Reason why run from block is disabled (for tooltip) */
runFromBlockDisabledReason?: string
disableEdit?: boolean
isExecuting?: boolean
}
@@ -77,7 +75,6 @@ export function BlockMenu({
hasClipboard = false,
showRemoveFromSubflow = false,
canRunFromBlock = false,
runFromBlockDisabledReason,
disableEdit = false,
isExecuting = false,
}: BlockMenuProps) {
@@ -228,11 +225,7 @@ export function BlockMenu({
}
}}
>
{isExecuting
? 'Execution in progress...'
: !canRunFromBlock && runFromBlockDisabledReason
? runFromBlockDisabledReason
: 'Run from this block'}
Run from block
</PopoverItem>
<PopoverItem
disabled={isExecuting}
@@ -243,7 +236,7 @@ export function BlockMenu({
}
}}
>
{isExecuting ? 'Execution in progress...' : 'Run until this block'}
Run until block
</PopoverItem>
</>
)}

View File

@@ -23,6 +23,7 @@ import { subscriptionKeys } from '@/hooks/queries/subscription'
import { useExecutionStream } from '@/hooks/use-execution-stream'
import { WorkflowValidationError } from '@/serializer'
import { useExecutionStore } from '@/stores/execution'
import { useNotificationStore } from '@/stores/notifications'
import { useVariablesStore } from '@/stores/panel'
import { useEnvironmentStore } from '@/stores/settings/environment'
import { type ConsoleEntry, useTerminalConsoleStore } from '@/stores/terminal'
@@ -101,11 +102,13 @@ export function useWorkflowExecution() {
setEdgeRunStatus,
setLastExecutionSnapshot,
getLastExecutionSnapshot,
clearLastExecutionSnapshot,
} = useExecutionStore()
const [executionResult, setExecutionResult] = useState<ExecutionResult | null>(null)
const executionStream = useExecutionStream()
const currentChatExecutionIdRef = useRef<string | null>(null)
const isViewingDiff = useWorkflowDiffStore((state) => state.isShowingDiff)
const addNotification = useNotificationStore((state) => state.addNotification)
/**
* Validates debug state before performing debug operations
@@ -1620,6 +1623,23 @@ export function useWorkflowExecution() {
onExecutionError: (data) => {
logger.error('Run-from-block execution error:', data.error)
// If block not found, the snapshot is stale - clear it
if (data.error?.includes('Block not found in workflow')) {
clearLastExecutionSnapshot(workflowId)
addNotification({
level: 'info',
message: 'Workflow was modified. Run the workflow again to refresh.',
workflowId,
})
logger.info('Cleared stale execution snapshot', { workflowId })
} else {
addNotification({
level: 'error',
message: data.error || 'Run from block failed',
workflowId,
})
}
},
onExecutionCancelled: () => {
@@ -1639,10 +1659,12 @@ export function useWorkflowExecution() {
[
getLastExecutionSnapshot,
setLastExecutionSnapshot,
clearLastExecutionSnapshot,
setIsExecuting,
setActiveBlocks,
setBlockRunStatus,
setEdgeRunStatus,
addNotification,
addConsole,
executionStream,
]

View File

@@ -3356,7 +3356,6 @@ const WorkflowContent = React.memo(() => {
(b) => b.parentId && (b.parentType === 'loop' || b.parentType === 'parallel')
)}
canRunFromBlock={runFromBlockState.canRun}
runFromBlockDisabledReason={runFromBlockState.reason}
disableEdit={!effectivePermissions.canEdit}
isExecuting={isExecuting}
/>