Skip to main content
Solved

Returned variables list is not the same order as in the UI


jaclyntan

When I use any of the variable functions to retrieve a list of local variables either from a list or collection (eg figma.variables.getLocalVariables() or figma.variables.getLocalVariableCollections()), the sort order of the list seems to be the order in which the variables were created. However, I would like sort order to reflect the order in the UI. Does anyone know a way around this or if it is indeed a bug/limitation?

Returning lists of color styles works as expected so this seems to be just a variables thing.

Best answer by ksn

@jaclyntan Got some good news! Don’t have an exact date for you, but the engineering team is going to start working on this, and it should be coming in a few weeks ‼️

Thanks again for taking the time to drop by with your feedback - change is happening because of it 😀

View original
This topic has been closed for replies.

6 replies

ksn
Figmate
  • Community Support
  • 1655 replies
  • July 27, 2023

@jaclyntan - at the moment, we don’t offer a way to sort the list that’s returned to you (so it will be ordered by creation date only).

Can you provide us more info on what having a different sort order would help you achieve? Would love additional context.


jaclyntan
  • Author
  • New Participant
  • 6 replies
  • July 28, 2023

I see, I am trying to print the variables to the canvas for the purpose of documentation. I think it is strange that color and text styles return lists that reflect the UI order, but variables are returned by creation date. If you are able to, could you suggest returning a sort order by UI for a future release? It would be much appreciated 🙂 Thank you.


ksn
Figmate
  • Community Support
  • 1655 replies
  • July 28, 2023

Yes definitely! Already passed it forward to the team that works on our API 😀


jaclyntan
  • Author
  • New Participant
  • 6 replies
  • July 28, 2023

Ahhh thank you so much!! I really appreciate it ♥️ Have a great rest of your day!


ksn
Figmate
  • Community Support
  • 1655 replies
  • Answer
  • July 28, 2023

@jaclyntan Got some good news! Don’t have an exact date for you, but the engineering team is going to start working on this, and it should be coming in a few weeks ‼️

Thanks again for taking the time to drop by with your feedback - change is happening because of it 😀


jaclyntan
  • Author
  • New Participant
  • 6 replies
  • July 28, 2023

That’s amazing news!!! 💌 Thank you Kim for taking the time to respond and follow up my request, I am truly grateful for the work you all do. 🙏


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings