From d93c4752cb2edbb8243f06ee72f16278f4c65335 Mon Sep 17 00:00:00 2001 From: Danila Poyarkov Date: Sat, 14 Mar 2026 12:47:51 +0300 Subject: [PATCH] Fix DSD resolution for swapped instance children MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After an instance swap, the DSD guidPath still references the pre-swap slot's overrideKey (e.g. bold icon), but the actual child is the swapped-in component (e.g. code-2). resolveOverrideTarget couldn't find the target because the child's componentId no longer matched the guidPath element. When findNodeByComponentId fails, fall back to the single child of the parent node — after a swap, it occupies the same slot. Fixes cropped toolbar icons (bold, italic, underline, strikethrough, link, lists, code) in the WYSIWYG editor. --- .../core/src/kiwi/instance-overrides/resolve.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/core/src/kiwi/instance-overrides/resolve.ts b/packages/core/src/kiwi/instance-overrides/resolve.ts index b4522d416..b03189646 100644 --- a/packages/core/src/kiwi/instance-overrides/resolve.ts +++ b/packages/core/src/kiwi/instance-overrides/resolve.ts @@ -129,8 +129,21 @@ export function resolveOverrideTarget(ctx: OverrideContext, instanceId: string, if (current?.componentId === remapped) continue const found = findNodeByComponentId(ctx, currentId, remapped) - if (!found) return null - currentId = found + if (found) { + currentId = found + continue + } + + // After an instance swap, the child's componentId points to the new + // component, not the one referenced by the guidPath. Fall back to the + // single child of a swapped instance — it occupies the same slot. + const parent = ctx.graph.getNode(currentId) + if (parent?.childIds.length === 1) { + currentId = parent.childIds[0] + continue + } + + return null } return currentId }