Problem
When a spec configures an instance-swap property — an icon on an avatar, for example — render does not apply it. The instance keeps whatever its component defaults to, so a component specified with one icon renders with another.
Background
Instance-swap values in a spec are component names. Figma's setProperties expects a published component key. Passing the name is rejected, so the configuration is currently skipped and reported:
⚠ [writer] propConfig "Avatar.icon": instance-swap properties take a component key, not a name — skipping
Skipping is deliberate — it was previously throwing and taking every other property on that instance down with it (fixed in #291) — but it leaves the configured value unapplied.
Solution
Resolve the configured name to a component key before applying it, using the manifests render already carries for this purpose:
instanceIdManifest — spec key to component reference
glyphIdManifest — glyph content name to component reference, which is how icons resolve elsewhere in the writer
InstanceElement.resolveEntry — same-file node id first, published-key import when the component lives in another file
Report and skip only when the name resolves to nothing.
Acceptance criteria
Fixtures
AvatarGroup — Avatar.icon is the live example
Subtask of #204.
Problem
When a spec configures an instance-swap property — an icon on an avatar, for example — render does not apply it. The instance keeps whatever its component defaults to, so a component specified with one icon renders with another.
Background
Instance-swap values in a spec are component names. Figma's
setPropertiesexpects a published component key. Passing the name is rejected, so the configuration is currently skipped and reported:Skipping is deliberate — it was previously throwing and taking every other property on that instance down with it (fixed in #291) — but it leaves the configured value unapplied.
Solution
Resolve the configured name to a component key before applying it, using the manifests render already carries for this purpose:
instanceIdManifest— spec key to component referenceglyphIdManifest— glyph content name to component reference, which is how icons resolve elsewhere in the writerInstanceElement.resolveEntry— same-file node id first, published-key import when the component lives in another fileReport and skip only when the name resolves to nothing.
Acceptance criteria
Fixtures
AvatarGroup—Avatar.iconis the live exampleSubtask of #204.