Skip to main content
Question

Variables order not always the same as the figma UI

  • October 2, 2024
  • 4 replies
  • 97 views

Youssef3
0: {name: 'color/Brand/Alpha/Primary', id: 'VariableID:1:18'}
1: {name: 'color/Brand/Alpha/Secondary', id: 'VariableID:1:3'}
2: {name: 'color/Brand/Primary', id: 'VariableID:1:17'}
3: {name: 'color/Brand/Secondary', id: 'VariableID:1:5'}
4: {name: 'font/family/primary', id: 'VariableID:1:8'}
5: {name: 'font/weight/regular', id: 'VariableID:1:10'}
6: {name: 'font/weight/medium', id: 'VariableID:1:11'}
7: {name: 'mode/modes', id: 'VariableID:1:7'}  <- resolvedType: String
8: {name: 'font/family/secondary', id: 'VariableID:1:9'}
9: {name: 'font/line height/string', id: 'VariableID:3:2'}

Hey everyone,

This is what’s returned by getLocalVariableCollectionsAsync().variables, and as you can see, the order isn’t correct. For instance, variables inside the font folder should be grouped together, and color/Brand/Primary & Secondary should appear before the nested folder color/Brand/Alpha.

It seems that whenever a string is involved in a variable collection (like in mode/modes, which is of type String), it messes up the order. I’ve noticed that if I randomly move the variable and then put it back in the correct place, sometimes the order is fixed, but other times it’s still completely off.

Has anyone else run into this, or found a reliable fix?

This topic has been closed for replies.

4 replies

Sasch
  • October 8, 2024

Good catch. I got the same issue/question. Is it not possible to fetch the collections and their variables with their original structure and order? @Gleb please do your magic and help us 😁


Gleb
  • Power Member
  • October 8, 2024

Not possible unfortunately. Hope they fix it someday.


Sajid
  • New Member
  • January 24, 2025

@Youssef3 Have you found any solution to this? 


Omar_Alharbi1
  • New Member
  • February 13, 2025

This. All plugins are now reporting variables order different from UI and what designers are seeing. Forcing them to reorder any output of theses plugins.