Skip to main content
Question

Custom data on EffectStyle using setPluginData() not working when published

  • February 21, 2022
  • 2 replies
  • 959 views

abynim

I’m using setPluginData() to add custom data on an EffectStyle. When a layer that has this style applied is selected, I can read this custom data when it’s a local style. But when I publish this style, and apply it to a layer in another document, getPluginData() shows up empty.

Is this a known issue? Or am I doing something wrong?

Steps to reproduce:

— Create a new Effect style
— Use setPluginData() to set custom info on that style
— Apply the style to a local node
— Read custom info from style linked to local node using figma.getStyleById(figma.currentPage.selection[0].effectStyleId).getPluginData() (this works)
— Publish the style as part of a library
— Enable the published library in another document
— Import and apply the style to a node in the second document
— Use getPluginData() to read custom info on the style applied in second document (this shows up empty)

2 replies

tank666
  • 4873 replies
  • February 22, 2022

I don’t think this is a bug, because the id of the local style is different from the id of the style from the library.

Local Style Id:

"S:1a2b…n9,"

Style Id from the library:

"S:1a2bn9,1:0"

abynim
  • Author
  • 1 reply
  • February 23, 2022

Thanks, I see that now. So I guess figma.getStyleById() in the consuming doc references a style object in the document’s local scope. Which makes sense, because this object could have its own state until library updates are synced.

Then I suppose the bug here is that plugin data is not included when styles are imported/synced from library docs into consuming documents?


Reply


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