Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Exporting Figma Variables (BETA) using references to other variables throws an error #254

Closed
Marvellanius opened this issue Jul 31, 2023 · 14 comments

Comments

@Marvellanius
Copy link

As the title states; When trying to Save & Export Figma Variables (BETA), we get the following error:

image (11)

I've been able to narrow it down to it being an issue with variables whose value references another variable.

To narrow it down, I exported all variables in our project with this plugin, which notably does not preserve references, tried to export Figma Variables with the Design Tokens plugin in the new file, which worked fine. Updated one of the variables to contain a reference to another variable as a value, and the above error occured.

Reproduce-file for the issue: https://www.figma.com/file/i9oPPuiKKceCgqMsmHwHsj/Design-Token-variable-export-reproduce

This worked fine at least as late as July 25th, so I suspect #253 might be the cause.

STR:

  • Open a Figma file
  • Make 2 variables, one with a non-reference value, the other referencing the variable made before
  • Try to use Design Tokens to save & export Figma Variables (BETA)
@maaltone
Copy link

I have similar issues..
caught TypeError: Cannot read properties of undefined (reading 'value') at <anonymous>:640:22114 at Object.rr (<anonymous>:640:22277) at <anonymous>:640:25588 at Array.map (<anonymous>) at fr (<anonymous>:640:25563) at onSubmit (<anonymous>:650:874) at Object.Te (<anonymous>:2:84110) at $e (<anonymous>:2:84264) at <anonymous>:2:104124 at Dr (<anonymous>:2:104218) (

@Marvellanius
Copy link
Author

I have similar issues.. caught TypeError: Cannot read properties of undefined (reading 'value') at <anonymous>:640:22114 at Object.rr (<anonymous>:640:22277) at <anonymous>:640:25588 at Array.map (<anonymous>) at fr (<anonymous>:640:25563) at onSubmit (<anonymous>:650:874) at Object.Te (<anonymous>:2:84110) at $e (<anonymous>:2:84264) at <anonymous>:2:104124 at Dr (<anonymous>:2:104218) (

I have also seen that error; difference between Chrome inspector and Firefox inspector output I'm guessing - the undefined referenced in your error is e.fill, as e.fill.value is referenced in the lines of code that get linked in the error message :)

@lukasoppermann
Copy link
Owner

Hey, thanks I can reproduce it. I will look into it asap.

@lukasoppermann
Copy link
Owner

Fix should be available in version 66. Please reopen if it persists

@bchipev
Copy link

bchipev commented Jul 31, 2023

Unfortunately the latest release causes a faulty "No tokens to export" toast. The issue @Marvellanius and I had (we're colleagues) is still not resolved.

@lukasoppermann
Copy link
Owner

Hey @bchipev can you try again, I hope I fixed it now.

@Marvellanius
Copy link
Author

@lukasoppermann how would we ensure that the vesion running in Figma is the newest version? As of this morning, I'm still experiencing the same issue as reported (e.fill is undefined when trying to export a set of variables with variable-referencing values)

@lukasoppermann
Copy link
Owner

Hey @Marvellanius, by closing and re-opening the figma tab you should normally get the latest version.

@Marvellanius
Copy link
Author

Then I sadly have to report that the issue persists :( different PC, so pretty sure that should run the latest version then

@lukasoppermann
Copy link
Owner

lukasoppermann commented Aug 1, 2023

Hmm, weird, did you try it with a new file? With just one color variable and a another one that references this one?

Or are you per chance using variables from another file? I think this is the issue. I can reproduce it. 🤔

@Marvellanius
Copy link
Author

Marvellanius commented Aug 1, 2023

Yes, I've tried with a new file, using just 2 variables, one with a hex-value for a color, the other referencing that variable

Scratch that, the 2 variables in a new file do work in the export, even if cross-referencing from a different collection in the same file.

I'll go see what the difference is with our project files vs my test-file and report back, as in our usecase we do define all the variables in the file from which we try to export. Given this, I'd expect it to work now 🤔

On that note; the error message also kind of confuses me; when exporting Variables, we're not dealing with fills at all, the error message thrown because a color variable is treated the same in your parser as a color style? (I've not had the time to dive into your source code yet)

@lukasoppermann
Copy link
Owner

Hey @Marvellanius it should now work with the tokens references from other files as well.

Yes fill comes, because in figma a color token is a color and a color is an object with a fill property.

@Marvellanius
Copy link
Author

Yes! I just now had a working export while trying to reproduce my issue, so can confirm it now works! Thanks so much for the quick turnaround 😄

@UgoJau
Copy link

UgoJau commented Sep 5, 2023

Hello there,

Happy to ear it its working for some, as for myself I get :
Uncaught TypeError: Cannot read properties of undefined (reading 'value') at <anonymous>:640:22206 at Object.ar (<anonymous>:640:22369) at <anonymous>:640:25680 at Array.map (<anonymous>) at pr (<anonymous>:640:25655) at onSubmit (<anonymous>:650:873) at Object.Te (<anonymous>:2:84110) at $e (<anonymous>:2:84264) at <anonymous>:2:104124 at Dr (<anonymous>:2:104218) (anonymous) @ VM2271:640 ar @ VM2271:640 (anonymous) @ VM2271:640 pr @ VM2271:640 onSubmit @ VM2271:650 Te @ VM2271:2 $e @ VM2271:2 (anonymous) @ VM2271:2 Dr @ VM2271:2 Ir @ VM2271:2 (anonymous) @ VM2271:2 uu @ VM2271:2 Ae @ VM2271:2 Br @ VM2271:2 Kn @ VM2271:2 qn @ VM2271:2

It works if I try with variables with no aliases, but as soon as I have some it doesn't.

In this file we have primitives -> Raw
Semantic -> aliases primitives
Tokens -> aliases semantic

Any help would be awesome. @lukasoppermann
Thanks

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

No branches or pull requests

5 participants