Skip to content

Reader: a code-only prop colliding with a native property name is silently dropped #344

Description

@nathanacurtis

A code-only prop whose name matches a native component property is dropped, and the spec ends up describing neither of them fully.

Code-only prop "Value" conflicts with native prop — skipping

Seen on a text input during a full-catalogue generate: the component carries a native TEXT property Value and a code-only prop of the same name in its hidden container. The native one wins, the code-only one is discarded, and everything the code-only prop carried — its type, its examples, and the $extensions['com.figma'].source provenance recording that it is code-only — is gone.

Why it is worth more than a warning

  • The prop disappears from the spec. A consumer generating an API surface never learns it exists.
  • It cannot round-trip. Render rebuilds code-only props from that provenance; with nothing recorded, a rendered component is missing the hidden layer the source has, and the next read of it is silent about the loss.
  • The warning is easy to miss. It prints mid-progress in a 66-component run, and the generate still reports success.

The question to settle

The current rule is first-wins-by-name, which is a decision made by accident of ordering rather than intent. Options worth weighing:

  • Emit both, distinguishing them — the code-only one already carries provenance that says what it is, so the two are not actually ambiguous in the data, only in the key.
  • Keep the collision but make it loud — a spec that silently omits a prop is worse than one that reports a conflict as an error a designer can fix by renaming.
  • Prefer neither and fail the component, on the grounds that a component with two props of one name is a design defect in the file rather than something the reader should paper over.

Whichever is chosen, the outcome should be visible in the spec rather than only in a line of console output.

Where

specs-from-figma/src/Component/Props/CodeOnlyProps/CodeOnlyProps.ts:85if (propName in existingProps), which skips and warns.

Metadata

Metadata

Assignees

No one assigned

    Labels

    generatorspecs-from-figma processing engine

    Type

    No type

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions