Code Connect throws errors in Figma UI after validating with the CLI

Offen
#383 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
43/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Ruhig
Tech-Stack
html, typescript

Rechercherichtung

Start by reading the Code Connect CLI validation and upload flow for HTML examples, then trace how published examples are interpreted in the Figma UI. Compare the reported figma.slot footer case with the banner's boolean and enum props; the payload does not identify relevant source files or tests. Done means both examples display correctly in Figma or provide actionable errors that explain how to fix the reported cases.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

API question

Code connect seems to throw errors after the CLI has validated it's files and provides no clear directions on what is happening or ways to resolve them. Here's my figma.config.json file.

{
  "codeConnect": {
    "include": ["src/components/**/*", "src/components/**/*.figma.*"],
    "parser": "html",
    "importPaths": {
      "components/**/*": "components"
    },
    "paths": {
      "components": ["src/components"]
    },
    "documentUrlSubstitutions": {}
  }
}

Both examples were published with the publish command and are web components.

/packages/components/src/components/blz-card/blz-card.figma.ts
/packages/components/src/components/blz-banner/blz-banner.figma.ts

Validating Code Connect files...
All Code Connect files are valid (12873ms)
Uploading to Figma...
uploading to https://api.figma.com/v1/code_connect
Successfully uploaded to Figma, for Web Components:
  • Code Connect CLI version: v1.4.2
  • Operating system: MacOS
Card

Here's the *figma.ts version of my card component:

import figma, {html} from '@figma/code-connect/html';

figma.connect(
  'https://www.figma.com/design/XXX',
  {
    props: {
      orientation: figma.enum('Orientation', {
        Vertical: 'vertical',
        Horizontal: 'horizontal',
      }),
      order: figma.enum('Order', {Default: 'default', Reverse: 'reverse'}),
      backplate: figma.enum('↳ Backplate', {True: 'true', False: 'false'}),
      media: figma.children('.Card/Media'),
      footer: figma.slot('↳ 🧩 Footer'),
    },
    imports: [
      "import '@blizzard/forge-components/components/blz-card/blz-card.js'",
    ],
    example: props =>
      html`<blz-card
        orientation="${props.orientation}"
        order="${props.order}"
        backplate="${props.backplate}"
      >
        <div slot="media">${props.media}</div>
        <div slot="footer">${props.footer}</div>
      </blz-card>`,
  },
);

And the structure in Figma:

Image

For some reason I get an error on Footer despite the names matching:

Image
Banner

In the case of my banner component the entire code connect samples errors.

import figma, {html} from '@figma/code-connect/html';

figma.connect(
  'https://www.figma.com/design/XXX',
  {
    props: {
      'auto-gradient': figma.boolean('Auto Gradient'),
      height: figma.enum('Height', {"Fixed":"fixed","Flex":"flex"}),
    },
    imports: ["import '@blizzard/forge-components/components/blz-banner/blz-banner.js'"],
    example: props =>
      html`<blz-banner auto-gradient="${props['auto-gradient']}" height="${props.height}">
      </blz-banner>`,
  },
);
Image
Vorherrschende Sprache
TypeScript
Sterne
1.6k
Forks
126
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus figma/code-connect

Alle Issues in figma/code-connect

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.