Nested props not syncing to code

Aberta
#368 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
35/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
typescript

Direção de pesquisa

Start by tracing how Code Connect 1.4.0 resolves figma.nestedProps for the conditional Badge in the supplied IconButton example. Reproduce the issue by changing Content or Variant in Figma and checking whether the generated code updates; done when both nested prop changes appear correctly in the generated code.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

API question

While integrating Figma with Code Connect, I encountered an issue with prop synchronization for nested components.

I have an IconButton component that conditionally renders a nested Badge component when the Show Badge property is set to true.

The Badge component has the following props:

  • Variant (Standard / Dot)
  • Content (only displayed when Variant is set to Standard)

Issue
When updating any of the Badge props in Figma:

  • Changing the Content value
  • Switching the Variant between Standard and Dot

…the changes are not reflected in the generated code via Code Connect (the changes are reflected in Figma).

Expected behavior
Changes made to the nested Badge component props should be propagated and correctly reflected in the generated code.

Actual behavior
The Badge props remain unchanged in the code, even though they are updated in Figma.

Code Connect version: 1.4.0
OS: Ubuntu

Code snippet:

figma.connect(
  IconButton,
  "figma_url",
  {
    props: {
      disabled: figma.enum("State", {
        Disabled: true,
      }),
      showBadge: figma.boolean("Show badge"),
      badge: figma.boolean("Show badge", {
        true: figma.nestedProps("<Badge>", {
          variant: figma.enum("Variant", {
            Standard: "standard",
            Dot: "dot",
          }),
          badgeContent: figma.enum("Variant", {
            Standard: figma.string("Content"),
            Dot: undefined,
          }),
        }),
        false: { variant: undefined, badgeContent: undefined },
      }),

      icon: figma.nestedProps("<Icon>", {
        name: figma.instance<string>("Icon instance"),
      }),
    },
    example: (props) => (
      <IconButton
        disabled={props.disabled}
        showBadge={props.showBadge}
        badgeContent={props.badge.badgeContent}
      >
        <Icon>{props.icon.name}</Icon>
      </IconButton>
    ),
  },
);
Image
Linguagem predominante
TypeScript
Estrelas
1.6k
Forks
126
Métricas de merge de PRs
Nenhum PR com merge em 30d

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de figma/code-connect

Todas as issues de figma/code-connect

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.