mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix(input-format): first time execution bug (#1068)
This commit is contained in:
@@ -548,8 +548,8 @@ export function useWorkflowExecution() {
|
||||
}
|
||||
})
|
||||
|
||||
// Merge subblock states from the appropriate store
|
||||
const mergedStates = mergeSubblockState(validBlocks)
|
||||
// Merge subblock states from the appropriate store (scoped to active workflow)
|
||||
const mergedStates = mergeSubblockState(validBlocks, activeWorkflowId)
|
||||
|
||||
// Debug: Check for blocks with undefined types after merging
|
||||
Object.entries(mergedStates).forEach(([blockId, block]) => {
|
||||
|
||||
@@ -213,13 +213,24 @@ export class Serializer {
|
||||
|
||||
const params: Record<string, any> = {}
|
||||
const isAdvancedMode = block.advancedMode ?? false
|
||||
const isStarterBlock = block.type === 'starter'
|
||||
|
||||
// First collect all current values from subBlocks, filtering by mode
|
||||
Object.entries(block.subBlocks).forEach(([id, subBlock]) => {
|
||||
// Find the corresponding subblock config to check its mode
|
||||
const subBlockConfig = blockConfig.subBlocks.find((config) => config.id === id)
|
||||
|
||||
if (subBlockConfig && shouldIncludeField(subBlockConfig, isAdvancedMode)) {
|
||||
// Include field if it matches current mode OR if it's the starter inputFormat with values
|
||||
const hasStarterInputFormatValues =
|
||||
isStarterBlock &&
|
||||
id === 'inputFormat' &&
|
||||
Array.isArray(subBlock.value) &&
|
||||
subBlock.value.length > 0
|
||||
|
||||
if (
|
||||
subBlockConfig &&
|
||||
(shouldIncludeField(subBlockConfig, isAdvancedMode) || hasStarterInputFormatValues)
|
||||
) {
|
||||
params[id] = subBlock.value
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user