fix: Code Connect using variant node IDs instead of component set node IDs#55
Conversation
…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>
Summary of ChangesHello @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
Changelog
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
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.codeConnectNodeIdcomputed property onComponentthat returns the parent component setnodeIdfor variants and ownnodeIdfor regular componentscodeConnectNodeIdtoAssetMetadataconstruction in both granular cache pathscodeConnectNodeIdtoImagePackconstruction for both vector and raster image loadingError before fix: