When I use any of the variable functions to retrieve a list of local variables either from a list or collection (eg
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.
@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.
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.
Yes definitely! Already passed it forward to the team that works on our API
Ahhh thank you so much!! I really appreciate it Have a great rest of your day!
@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
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.