MCPcopy Index your code
hub / github.com/simstudioai/sim / captureLatestSubBlockValues

Function captureLatestSubBlockValues

apps/sim/stores/undo-redo/utils.ts:214–236  ·  view source on GitHub ↗
(
  blocks: Record<string, BlockState>,
  workflowId: string,
  blockIds: string[]
)

Source from the content-addressed store, hash-verified

212}
213
214export function captureLatestSubBlockValues(
215 blocks: Record<string, BlockState>,
216 workflowId: string,
217 blockIds: string[]
218): Record<string, Record<string, unknown>> {
219 const values: Record<string, Record<string, unknown>> = {}
220 blockIds.forEach((blockId) => {
221 const merged = mergeSubblockState(blocks, workflowId, blockId)
222 const block = merged[blockId]
223 if (block?.subBlocks) {
224 const blockValues: Record<string, unknown> = {}
225 Object.entries(block.subBlocks).forEach(([subBlockId, subBlock]) => {
226 if (subBlock.value !== null && subBlock.value !== undefined) {
227 blockValues[subBlockId] = subBlock.value
228 }
229 })
230 if (Object.keys(blockValues).length > 0) {
231 values[blockId] = blockValues
232 }
233 }
234 })
235 return values
236}

Callers 2

utils.test.tsFile · 0.90
useUndoRedoFunction · 0.90

Calls 1

mergeSubblockStateFunction · 0.90

Tested by

no test coverage detected