Skip to main content
JR13
January 8, 2024
Question

DocumentChange events don't support Variables

  • January 8, 2024
  • 3 replies
  • 311 views

Hi,

My plugin handles live updates when a Style changes, thanks to StyleCreateChange | StyleDeleteChange | StylePropertyChange events.

I’m currently working with Variables and have noticed that there’s no way to achieve a similar behavior due to the lack of Variable events. Is this something that will exist in the near future?

Thanks!

This topic has been closed for replies.

3 replies

tank666
January 8, 2024

This is not currently a bug because it hasn’t been implemented yet and the variables are in beta.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Elisha2
July 4, 2024

Hi, we also encountered this problem, the style change callbacks can’t work when local variables change. Could I ask when it will be supported ? Thank you~

figma.on("documentchange", (event) =>
{
  for (const change of event.documentChanges)
  {
    switch (change.type)
    {
      case "STYLE_CREATE":
        break;
      case "STYLE_DELETE":
        break;
       case "STYLE_PROPERTY_CHANGE":
         break;
    }
  }
}
mfilipiec
September 12, 2024

Hello! I also encountered this problem.

Since Local variables are out of beta, is there any way to listen for changes in variables? Or when will this option be added to the API?

“documentchange”, “nodechange” and “stylechange” do not listen for these changes. The only way is to use setInterval and compare changes manually but it is not efficient and the best solution.

Thanks!