Skip to content

Commit 5caef3a

Browse files
fix(input-format): first time execution bug (#1068)
1 parent a6888da commit 5caef3a

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,8 @@ export function useWorkflowExecution() {
548548
}
549549
})
550550

551-
// Merge subblock states from the appropriate store
552-
const mergedStates = mergeSubblockState(validBlocks)
551+
// Merge subblock states from the appropriate store (scoped to active workflow)
552+
const mergedStates = mergeSubblockState(validBlocks, activeWorkflowId)
553553

554554
// Debug: Check for blocks with undefined types after merging
555555
Object.entries(mergedStates).forEach(([blockId, block]) => {

apps/sim/serializer/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,24 @@ export class Serializer {
213213

214214
const params: Record<string, any> = {}
215215
const isAdvancedMode = block.advancedMode ?? false
216+
const isStarterBlock = block.type === 'starter'
216217

217218
// First collect all current values from subBlocks, filtering by mode
218219
Object.entries(block.subBlocks).forEach(([id, subBlock]) => {
219220
// Find the corresponding subblock config to check its mode
220221
const subBlockConfig = blockConfig.subBlocks.find((config) => config.id === id)
221222

222-
if (subBlockConfig && shouldIncludeField(subBlockConfig, isAdvancedMode)) {
223+
// Include field if it matches current mode OR if it's the starter inputFormat with values
224+
const hasStarterInputFormatValues =
225+
isStarterBlock &&
226+
id === 'inputFormat' &&
227+
Array.isArray(subBlock.value) &&
228+
subBlock.value.length > 0
229+
230+
if (
231+
subBlockConfig &&
232+
(shouldIncludeField(subBlockConfig, isAdvancedMode) || hasStarterInputFormatValues)
233+
) {
223234
params[id] = subBlock.value
224235
}
225236
})

0 commit comments

Comments
 (0)