|
|
@@ -808,25 +808,26 @@ function WorkflowEditorInner() {
|
|
|
|
|
|
// Handle WebSocket reconnection - reset execution state to prevent stuck workflows
|
|
|
const handleReconnect = () => {
|
|
|
- console.log('WebSocket reconnected - resetting execution state')
|
|
|
- // If there was a pending execution, it's now stale - reset it
|
|
|
+ // Clear pending refs
|
|
|
if (pendingExecIdRef.current) {
|
|
|
pendingExecIdRef.current = null
|
|
|
pendingEventsRef.current = []
|
|
|
- setExecutionState((prev) => {
|
|
|
- // Only reset if execution was still running
|
|
|
- if (prev.status === 'running') {
|
|
|
- showToast('info', 'Connection restored - execution state reset. Please re-run if needed.')
|
|
|
- return {
|
|
|
- executionId: null,
|
|
|
- status: 'idle',
|
|
|
- nodeStates: {},
|
|
|
- }
|
|
|
- }
|
|
|
- return prev
|
|
|
- })
|
|
|
- setExecutingNodeId(null)
|
|
|
}
|
|
|
+
|
|
|
+ // Always check and reset running state on reconnect
|
|
|
+ setExecutionState((prev) => {
|
|
|
+ if (prev.status === 'running') {
|
|
|
+ console.log('WebSocket reconnected - resetting stuck running execution')
|
|
|
+ showToast('info', 'Connection restored - execution state reset. Please re-run if needed.')
|
|
|
+ return {
|
|
|
+ executionId: null,
|
|
|
+ status: 'idle',
|
|
|
+ nodeStates: {},
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return prev
|
|
|
+ })
|
|
|
+ setExecutingNodeId(null)
|
|
|
}
|
|
|
|
|
|
wsClient.onReconnect(handleReconnect)
|