From 72ec3ee576dcfbb94eabddabf64f35debda9198b Mon Sep 17 00:00:00 2001 From: Danila Poyarkov Date: Sat, 14 Mar 2026 11:17:56 +0300 Subject: [PATCH] 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. --- packages/core/src/kiwi/instance-overrides/index.ts | 2 +- packages/core/src/kiwi/instance-overrides/sync.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/core/src/kiwi/instance-overrides/index.ts b/packages/core/src/kiwi/instance-overrides/index.ts index 0a4cbfbb5..04d4598b3 100644 --- a/packages/core/src/kiwi/instance-overrides/index.ts +++ b/packages/core/src/kiwi/instance-overrides/index.ts @@ -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) diff --git a/packages/core/src/kiwi/instance-overrides/sync.ts b/packages/core/src/kiwi/instance-overrides/sync.ts index 809dff62a..a0c13087f 100644 --- a/packages/core/src/kiwi/instance-overrides/sync.ts +++ b/packages/core/src/kiwi/instance-overrides/sync.ts @@ -131,7 +131,8 @@ export function propagateOverridesTransitively( graph: SceneGraph, seeds: Set, swappedInstances: Set, - componentIdRoot: Map + componentIdRoot: Map, + protect?: Set ): 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() 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) }