MCPcopy
hub / github.com/simstudioai/sim / updateBlockReferences

Function updateBlockReferences

apps/sim/stores/workflows/utils.ts:307–330  ·  view source on GitHub ↗
(
  blocks: Record<string, BlockState>,
  nameMap: Map<string, string>,
  clearTriggerRuntimeValues = false
)

Source from the content-addressed store, hash-verified

305}
306
307function updateBlockReferences(
308 blocks: Record<string, BlockState>,
309 nameMap: Map<string, string>,
310 clearTriggerRuntimeValues = false
311): void {
312 Object.entries(blocks).forEach(([_, block]) => {
313 if (block.subBlocks) {
314 Object.entries(block.subBlocks).forEach(([subBlockId, subBlock]) => {
315 if (clearTriggerRuntimeValues && TRIGGER_RUNTIME_SUBBLOCK_IDS.includes(subBlockId)) {
316 block.subBlocks[subBlockId] = { ...subBlock, value: null }
317 return
318 }
319
320 if (subBlock.value !== undefined && subBlock.value !== null) {
321 const updatedValue = updateValueReferences(
322 subBlock.value,
323 nameMap
324 ) as SubBlockState['value']
325 block.subBlocks[subBlockId] = { ...subBlock, value: updatedValue }
326 }
327 })
328 }
329 })
330}
331
332export function regenerateWorkflowIds(
333 workflowState: WorkflowState,

Callers 2

regenerateWorkflowIdsFunction · 0.85
regenerateBlockIdsFunction · 0.85

Calls 1

updateValueReferencesFunction · 0.85

Tested by

no test coverage detected