MCPcopy Index your code
hub / github.com/pascalorg/editor / parseUpdatedNode

Function parseUpdatedNode

packages/core/src/store/actions/node-actions.ts:481–496  ·  view source on GitHub ↗
(currentNode: AnyNode, data: Partial<AnyNode>)

Source from the content-addressed store, hash-verified

479}
480
481function parseUpdatedNode(currentNode: AnyNode, data: Partial<AnyNode>): AnyNode {
482 const candidate = { ...currentNode, ...data }
483 const parsed = AnyNodeSchema.safeParse(candidate)
484 if (parsed.success) return parsed.data
485
486 const schema = getNodeSchemaForType(candidate.type)
487 const sanitized = sanitizeNumericValue(schema, data, currentNode, [])
488
489 if (sanitized.issues.length === 0) {
490 return candidate as AnyNode
491 }
492
493 warnSanitizedNodeMutation('update', currentNode.id, sanitized.issues)
494
495 return { ...currentNode, ...(sanitized.value as Partial<AnyNode>) } as AnyNode
496}
497
498// Track pending RAF for updateNodesAction to prevent multiple queued callbacks
499let pendingRafId: number | null = null

Callers 2

applyNodeChangesActionFunction · 0.85
updateNodesActionFunction · 0.85

Calls 3

getNodeSchemaForTypeFunction · 0.85
sanitizeNumericValueFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…