Fix text/property overrides clobbered by second transitive sync

The second propagateOverridesTransitively (for component property
changes) was overwriting nodes that had explicit symbolOverride values
(text, fills, etc.) set in the first pass. The second sync's skip set
only contained propModified nodes, not the original symbolOverride
targets.

Pass overriddenNodes as a 'protect' set to the second sync. These
nodes are skipped at both the top-level clone check and during
recursive syncChildrenDeep.

Fixes: Step text ('Details'/'Terms'/'Members'), Input placeholder
('Enter name'), Tooltip title ('Bold') in gold-preview.fig.
This commit is contained in:
Danila Poyarkov 2026-03-14 11:17:56 +03:00
parent 4caf4281fd
commit 72ec3ee576
2 changed files with 10 additions and 4 deletions

View file

@ -92,7 +92,7 @@ export function populateAndApplyOverrides(
const propModified = applyComponentProperties(ctx)
if (propModified.size > 0) {
propagateOverridesTransitively(graph, propModified, ctx.swappedInstances, ctx.componentIdRoot)
propagateOverridesTransitively(graph, propModified, ctx.swappedInstances, ctx.componentIdRoot, overriddenNodes)
}
applyDerivedSymbolData(ctx)

View file

@ -131,7 +131,8 @@ export function propagateOverridesTransitively(
graph: SceneGraph,
seeds: Set<string>,
swappedInstances: Set<string>,
componentIdRoot: Map<string, string>
componentIdRoot: Map<string, string>,
protect?: Set<string>
): void {
if (seeds.size === 0) return
@ -140,6 +141,11 @@ export function propagateOverridesTransitively(
const expandedSeeds = expandSeedsToParents(graph, seeds)
const needsSync = buildNeedsSyncSet(expandedSeeds, clonesOf)
// Merge seeds + protect into a single skip set for syncChildrenDeep
const skip = protect && protect.size > 0
? new Set([...seeds, ...protect])
: seeds
const visited = new Set<string>()
const syncQueue = [...expandedSeeds]
for (let sourceId = syncQueue.shift(); sourceId !== undefined; sourceId = syncQueue.shift()) {
@ -154,7 +160,7 @@ export function propagateOverridesTransitively(
const node = graph.getNode(cloneId)
if (!node) continue
if (seeds.has(cloneId)) {
if (skip.has(cloneId)) {
syncQueue.push(cloneId)
continue
}
@ -166,7 +172,7 @@ export function propagateOverridesTransitively(
graph.populateInstanceChildren(node.id, sourceId)
}
} else if (source.childIds.length > 0 && node.childIds.length > 0) {
syncChildrenDeep(graph, sourceId, node.id, swappedInstances, seeds)
syncChildrenDeep(graph, sourceId, node.id, swappedInstances, skip)
}
syncQueue.push(cloneId)
}