Skip to main content
Question

Figma TeamLibrary Variables Functions not working


Martyn_Bowis

The following code used to work:

var libraryCollections = await Figma.teamLibrary.getAvailableLibraryVariableCollectionsAsync();
console.log(‘libraryCollections…’);
console.log(libraryCollections);

Right now, it is not working and simply returns an empty array.

Is there a new bug in Figma?

Team libraries are enabled.

This topic has been closed for replies.

6 replies

Celine_
Figmate
  • Community Support
  • 3688 replies
  • March 13, 2024

Hi there!
I see on our backend that you have filled out a support ticket, and the team is currently investigating it.
Feel free to share any insight to the community when your request is solved! 🙂


tank666
  • 4873 replies
  • March 13, 2024

From my side everything works as expected. The getAvailableLibraryVariableCollectionsAsync returns a non-zero length array.

Does the library have published variables? Have you tried republishing it?


Martyn_Bowis
  • Author
  • Active Member
  • 29 replies
  • March 13, 2024

Will let you know once there is a solution. Still not working at this moment.

Currently, there appears to be an issue when starting Figma. TeamLibrary variables are not loading using the code above.

To resolve this, I can toggle the mode for an instance from the TeamLibrary that is in the design file. After toggling the mode of that instance from the TeamLibrary, then the TeamLibrary variables may be loaded using the code above.

How to replicate issue: try restarting Figma and running the code above. Expect that will enable you to see the issue at play.

It would be good to have this resolved at the Figma system level.

A work-around for now is to:

When running the code, have an instance from the TeamLibrary dropped onto the page, toggle the mode, remove that instance. This hack effectively implements what is needed to invoke awareness / loading of the TeamLibrary variables.


Matan_Arbel

Anything new with getting this one solved?


I’m facing the same issue now. My working code all of a sudden stopped working! The work-around also does not work for me…

Any info about this one?


Bala_Sivagnanam
    console.log("Fetching library variable collections...");
    const libraryCollections = await figma.teamLibrary.getAvailableLibraryVariableCollectionsAsync();
    console.log("Library collections:", libraryCollections);

I have this code and this returns me empty array as well. But I clearly have libraries added and I am able to add components from there and also drag drop on the same file where I am running this plugin.


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