Skip to content

Commit eff731b

Browse files
author
Theodore Li
committed
Fix isRunning being stuck in true
1 parent 9d6a87b commit eff731b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { v4 as uuidv4 } from 'uuid'
2+
import { createLogger } from '@sim/logger'
23
import type {
34
BlockCompletedData,
45
BlockErrorData,
@@ -12,6 +13,8 @@ import type {
1213
StreamingExecution,
1314
} from '@/executor/types'
1415
import { stripCloneSuffixes } from '@/executor/utils/subflow-utils'
16+
const logger = createLogger('workflow-execution-utils')
17+
1518
import { useExecutionStore } from '@/stores/execution'
1619
import type { ConsoleEntry, ConsoleUpdate } from '@/stores/terminal'
1720
import { useTerminalConsoleStore } from '@/stores/terminal'
@@ -322,7 +325,12 @@ export function createBlockEventHandlers(
322325
if (isContainerBlockType(data.blockType) && !data.iterationContainerId) {
323326
const output = data.output as Record<string, any> | undefined
324327
const isEmptySubflow = Array.isArray(output?.results) && output.results.length === 0
325-
if (!isEmptySubflow) return
328+
if (!isEmptySubflow) {
329+
if (includeStartConsoleEntry) {
330+
updateConsoleEntry(data)
331+
}
332+
return
333+
}
326334
}
327335

328336
accumulatedBlockLogs.push(createBlockLogEntry(data, { success: true, output: data.output }))
@@ -334,7 +342,9 @@ export function createBlockEventHandlers(
334342
}
335343

336344
if (onBlockCompleteCallback) {
337-
onBlockCompleteCallback(data.blockId, data.output).catch(() => {})
345+
onBlockCompleteCallback(data.blockId, data.output).catch((error) => {
346+
logger.error('Error in onBlockComplete callback:', { blockId: data.blockId, error })
347+
})
338348
}
339349
}
340350

0 commit comments

Comments
 (0)