Skip to content

Commit 75898c6

Browse files
fix(start): seed initial subblock values on batch add (#2864)
1 parent b146728 commit 75898c6

File tree

1 file changed

+17
-1
lines changed
  • apps/sim/app/workspace/[workspaceId]/w/[workflowId]

1 file changed

+17
-1
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,23 @@ const WorkflowContent = React.memo(() => {
700700
triggerMode,
701701
})
702702

703-
collaborativeBatchAddBlocks([block], autoConnectEdge ? [autoConnectEdge] : [], {}, {}, {})
703+
const subBlockValues: Record<string, Record<string, unknown>> = {}
704+
if (block.subBlocks && Object.keys(block.subBlocks).length > 0) {
705+
subBlockValues[id] = {}
706+
for (const [subBlockId, subBlock] of Object.entries(block.subBlocks)) {
707+
if (subBlock.value !== null && subBlock.value !== undefined) {
708+
subBlockValues[id][subBlockId] = subBlock.value
709+
}
710+
}
711+
}
712+
713+
collaborativeBatchAddBlocks(
714+
[block],
715+
autoConnectEdge ? [autoConnectEdge] : [],
716+
{},
717+
{},
718+
subBlockValues
719+
)
704720
usePanelEditorStore.getState().setCurrentBlockId(id)
705721
},
706722
[collaborativeBatchAddBlocks, setSelectedEdges]

0 commit comments

Comments
 (0)