Updates for 2023-10-18
The Plugin API runtime has been updated to ensure proper usage of figma.showUI
.
It is unsafe to call figma.showUI
within an event handler for the figma.codegen.on("generate")
event. In development, figma.showUI
will now throw an error when called as a result of a figma.codegen.on("generate")
If you need to trigger code inside an iframe as the result of a generate callback, you should instead move the call to showUI
outside of the event handler and use figma.ui.postMessage
to communicate with the iframe from within the callback. This will ensure that your plugin can to handle concurrent generate
events. Here's a code example for how to do this.