Skip to content

fix: Code Connect using variant node IDs instead of component set node IDs#55

Merged
alexey1312 merged 3 commits intomainfrom
fix/code-connect-variant-node-ids
Feb 11, 2026
Merged

fix: Code Connect using variant node IDs instead of component set node IDs#55
alexey1312 merged 3 commits intomainfrom
fix/code-connect-variant-node-ids

Conversation

@alexey1312
Copy link
Copy Markdown
Collaborator

Description

Fix Figma Code Connect publish errors for icons with RTL variants. ExFig was passing variant node IDs (e.g. RTL=Off) to Code Connect, but the API requires top-level component or component set node IDs.

  • Add codeConnectNodeId computed property on Component that returns the parent component set nodeId for variants and own nodeId for regular components
  • Apply codeConnectNodeId to AssetMetadata construction in both granular cache paths
  • Apply codeConnectNodeId to ImagePack construction for both vector and raster image loading
  • Add 3 unit tests covering variant, regular component, and multi-property variant cases

Error before fix:

node is not a top level component or component set. Please check that the node is not a variant

…riant node IDs

Figma Code Connect API requires top-level component or component set node IDs,
but ExFig was passing variant node IDs (e.g. RTL=Off) which caused publish errors:
"node is not a top level component or component set"

Add `codeConnectNodeId` computed property on Component that returns the parent
component set nodeId for variants and own nodeId for regular components. Apply it
to AssetMetadata and ImagePack construction in all code paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @alexey1312, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue preventing Figma Code Connect from publishing icons, particularly those with RTL variants, due to an API requirement for top-level component or component set node IDs. The changes introduce a mechanism to correctly identify and provide these required node IDs, thereby enabling successful integration with Figma Code Connect for all component types.

Highlights

  • New codeConnectNodeId property: Introduced a computed property codeConnectNodeId on the Component extension. This property returns the parent component set's nodeId for variants and the component's own nodeId for regular components, addressing Figma Code Connect's requirement for top-level node IDs.
  • Integration in ImageLoaderBase: Modified ImageLoaderBase to utilize the new codeConnectNodeId when constructing AssetMetadata and ImagePack instances. This ensures that the correct node IDs are passed to Figma Code Connect for both granular cache paths and image loading processes.
  • Unit Test Coverage: Added three new unit tests in ComponentRTLTests to verify the correct behavior of codeConnectNodeId for variant components, regular components, and multi-property variant components, ensuring the fix works as expected.
Changelog
  • Sources/ExFigCLI/Loaders/ImageLoaderBase.swift
    • Updated AssetMetadata creation to use component.codeConnectNodeId instead of the direct nodeId.
    • Modified ImagePack creation to use component.codeConnectNodeId for the primaryNodeId.
    • Added comments to clarify the use of codeConnectNodeId for Figma Code Connect requirements.
  • Tests/ExFigTests/Loaders/ComponentRTLTests.swift
    • Added testCodeConnectNodeId_variantComponent_usesComponentSetNodeId to verify correct ID for variants.
    • Added testCodeConnectNodeId_regularComponent_usesOwnNodeId to verify correct ID for regular components.
    • Added testCodeConnectNodeId_variantWithMultipleProperties_usesComponentSetNodeId for multi-property variants.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@alexey1312 alexey1312 changed the title Fix Code Connect using variant node IDs instead of component set node IDs fix: Code Connect using variant node IDs instead of component set node IDs Feb 11, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request effectively addresses the issue of Figma Code Connect publishing errors by correctly using component set node IDs for variants. The introduction of the codeConnectNodeId computed property on Component is a clean and effective solution. The changes are consistently applied across AssetMetadata and ImagePack constructions, and the new unit tests provide good coverage for the added functionality. The code is well-documented and follows good Swift practices.

@alexey1312 alexey1312 merged commit ccca999 into main Feb 11, 2026
1 check passed
@alexey1312 alexey1312 deleted the fix/code-connect-variant-node-ids branch February 11, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant