Codegen - generate callback not called when switching languages

The documentation states the following:

Plugins in Dev Mode specifically built for code generation (“codegen”) appear in the Figma’s native language dropdown. Once selected from this menu, the figma.codegen.on("generate") callback will get called any time the user’s selection changes.

This is working well for me the first time I select a language, no matter which one (I’m supporting 2 atm).
However, whenever I switch to the other language, the callback is not called and Figma Dev UI shows a loading indicator indefinitely, but my plugin is never invoked.

If I select another node or change the “select” preferences, then the plugin is reloaded and the figma.codegen.on("generate") callback is called with the new language. But again, if I try to select the other language, it goes back to the indefinite loading state.

Notes:

  • Plugin is in development (not published)
  • No matter what language I select first, both work the first time, but the callback is not called when the other one is selected.
  • I’m using Figma Desktop App (Optimized for Apple Silicon) v116.17.11

I suspect this could have something to do with running the plugin in development mode.
Is this a known bug? Or is there something else I’m missing?

This is a bug and being tracked internally! Thanks for reaching out, ive added this info for the team.

1 Like