Skip to content

Fill a nested instance's non-default slot from its binding on render #680

Description

@nathanacurtis

Problem

A component's spec can consolidate a default-slot fill into its own layout tree while a non-default slot on the same nested instance stays bound to its own content entry (ADR-099). Render handles the first half and not the second: the consolidated tree is rebuilt correctly, and the bound slot is left empty.

The content is therefore lost on a round trip. Rendering such a spec and capturing the result back produces a spec with the binding and its entry gone, because there is nothing in the Figma file to capture.

Render reports nothing — the run succeeds with no warning.

Potential solution(s)

  • Fill a nested instance's non-default slot from the entry its binding points at, the same way a component's own slot binding is filled
  • Where the instance is itself content that arrived through a default-slot fill, resolve the binding against the host spec that carries it rather than the instance's own component, which render does not hold
  • Warn when a binding names a slot the instance does not expose, rather than completing silently

Acceptance criteria

  • A nested instance's non-default slot is filled from the entry its binding names
  • A spec rendered and captured back keeps both the consolidated tree and the bound slot's content
  • The default slot's consolidated children are unaffected
  • A binding that cannot be resolved is named in a warning rather than passing silently

Case data

  • Fixture: testSlotNonDefaultNested
  • Workspace: specs-testing — round-trip testing
  • Territory: figma-from-specs
  • Size: m

Notes

Found by round-tripping the fix for #677, which closed the capture half. Capture now emits the correct shape:

layout: [root: [levelZeroText, level1: [twoSlots: [aChild]]]]
twoSlots:
  propConfigurations:
    aside: { $slotContent: "…/slotContentExamples/testSlotTwoSlots__aside__default" }

Rendering that and capturing it back returns the tree intact and no aside — the bound entry's text never reaches the canvas.

Worth noting for whoever picks this up: a spec copied away from its run metadata loses the naming convention it needs, and render then fails to resolve instance elements for an unrelated reason. Keep latest.metadata.yaml beside a spec folder when rendering one in isolation, or the symptom looks like this issue and is not.


Implementation details are tracked internally.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

figma-from-specsTransformer from specs into Figma assetspluginFigma plugin

Type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions