code-connect icon indicating copy to clipboard operation
code-connect copied to clipboard

Omit Nested Components from Generated Snippets When Undefined in Code Connect

Open lindseydrennan opened this issue 6 months ago • 0 comments

I’m using Code Connect and would like generated code snippets to omit nested components entirely when they are mapped to ‎undefined or not present, especially for cases like secondary buttons or optional nested objects. Right now, if I try to conditionally render a nested prop, the generated code snippet outputs variable references or the conditional logic itself, rather than omitting the prop or inlining the actual values.

Can you add support for resolving these conditionals so the code snippet only includes nested props when they are defined, and inlines their literal values when possible? This would make the generated code much cleaner and more accurate for real-world React component usage.

Example: We have a CTA that has the option for 1 or 2 buttons. I need to be able to have the code render in Figma to show the 2 buttons code when both are present. Currently I cannot do that. Our buttons have label and className props so it would make the code much more accurate.

Image

lindseydrennan avatar Aug 19 '25 20:08 lindseydrennan