figma.string() renders as template literal instead of actual value when used within conditional boolean props

Đang mở
#304 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
react, typescript
Lĩnh vực
devtools

Hướng nghiên cứu

Start by tracing how figma.boolean() handles conditional JSX props and how nested figma.string() values are rendered in the generated snippet; the issue names no source files or tests. Reproduce the example against Code Connect 1.3.4 and identify the rendering path for the true branch. Done means the snippet displays the Figma string value when Show Description is true.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

feature request

Bug Description

When using figma.string() inside a conditional boolean prop mapping, the generated code snippet shows the template literal { figma.string('Property Name') } instead of the actual string value from Figma.

Expected Behavior

When Show Description is true, the code snippet should display:

<CardHeader>
  <CardTitle>Title Text</CardTitle>
  <CardDescription>This is a card description.</CardDescription>
</CardHeader>

Actual Behavior

The code snippet shows:

<CardHeader>
  <CardTitle>Title Text</CardTitle>
  <CardDescription>{ figma.string('Description Text') }</CardDescription>
</CardHeader>

Code Sample

figma.connect(
  CardHeader,
  'figma-url',
  {
    props: {
      cardDescription: figma.boolean('Show Description', {
        true: <CardDescription>{ figma.string('Description Text') }</CardDescription>,
        false: undefined,
      }),
      titleText: figma.string('Title Text'),
    },
    example: (props) => (
      <CardHeader>
        <CardTitle>{ props.titleText }</CardTitle>
        { props.cardDescription }
      </CardHeader>
    ),
  },
);

Environment

Figma Code Connect version: 1.3.4
Framework: React

Figma Component Instance

Image
Ngôn ngữ chính
TypeScript
Star
1.6k
Fork
126
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của figma/code-connect

Tất cả issue của figma/code-connect

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.