Skip to content

fix: Multiple styles with identical names from Figma silently overwrite each other #223

@JesperBellenbaum

Description

@JesperBellenbaum

Description
Multiple styles with identical names from Figma silently overwrite each other during code generation. Only the last style is kept, with no warning to the user.

Steps To Reproduce

  1. Create a Figma file with multiple styles having the same name (e.g., "Headline/Headline 2") but different node IDs
  2. Run figmage forge -f <fileId> -t <token>
  3. Check generated typography file
  4. Notice only one "Headline 2" style is present despite Figma having multiple

Expected Behavior

  • Warn user about duplicate style names detected from Figma API
  • Either generate unique names for all duplicates (e.g., headline2, headline2_1, headline2_2)
  • Or allow user to configure which duplicates to keep/exclude

Screenshots
N/A - can provide API response showing duplicate styles if needed

Additional Context

  • Occurs in base_file_generator.dart:75-99 when grouping tokens by collectionId
  • Figma API returns multiple nodes with same name but different id values
  • Currently uses collectionName from first token, causing Map key collisions for duplicates
  • Affects both /v1/files/{fileId}/styles and /v1/files/{fileId} endpoints
    EOF
    cat /tmp/duplicate_styles_issue.md
    Description
    Multiple styles with identical names from Figma silently overwrite each other during code generation. Only the last style is kept, with no warning to the user.

Steps To Reproduce

  1. Create a Figma file with multiple styles having the same name (e.g., "Headline/Headline 2") but different node IDs
  2. Run figmage forge -f <fileId> -t <token>
  3. Check generated typography file
  4. Notice only one "Headline 2" style is present despite Figma having multiple

Expected Behavior

  • Warn user about duplicate style names detected from Figma API
  • Either generate unique names for all duplicates (e.g., headline2, headline2_1, headline2_2)
  • Or allow user to configure which duplicates to keep/exclude

Screenshots
N/A - can provide API response showing duplicate styles if needed

Additional Context

  • Occurs in base_file_generator.dart:75-99 when grouping tokens by collectionId
  • Figma API returns multiple nodes with same name but different id values
  • Currently uses collectionName from first token, causing Map key collisions for duplicates
  • Affects both /v1/files/{fileId}/styles and /v1/files/{fileId} endpoints

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions