Whenever I enable the Dev Mode, the RelaunchData button are still shown under the “Plugin actions” section, but clicking them seems to be completely ignored.
The plugin is not invoked and I don’t receive any callback.
My plugin supports Figma
and Dev
modes + codegen
.
It also supports inspect
, but I already tried it without the inspect
capability and the problem persists.
Is this a bug or some kind of incompatibility I’m not aware of?
Extra info:
- Plugin is in still development (not published)
- I’m using Figma Desktop App (Optimized for Apple Silicon)
v116.17.11
What should happen when the user clicks on the relaunch button? How do you handle a command in code.js?
Depending on the button, sometimes it’ll perform a non-UI action (like cleaning the plugin data associated to the selected node), and in other cases it will show a UI to let the user interact with the plugin.
I’m currently checking the figma.command
value to know which (if any) button was clicked, but in dev
mode my plugin is not invoked when the user clicks the button, so I don’t receive any command.
I added a console.log
at the beginning of the code.ts
file to check if the plugin is run when I click the relaunch button in dev
mode, but nothing is printed in this scenario.
In default
mode all works as expected.
Note: I’m aware in Dev mode is a read-only mode, but the plugin will only edit the plugin data associated to the node, not the document itself.
Have you tried choosing another codegen plugin or native languages for code snippets (for example, CSS), and only then clicking on the relaunch button of your plugin and checking the console?
Good point @tank666
I tried what you suggested and this is the behaviour:
-
With inspect
capability enabled and one of the native languages selected in the code section, clicking the relaunch button seems to work (the UI is shown in the plugins
panel).
-
If I disable the inspect
capability and click the button, then an error is shown in the console asking me to enable it.
-
But if I enable inspect
capability and my plugin is currently selected for codegen
, my relaunch buttons click doesn’t trigger anything in my plugin.
So, if your plugin is selected as current codegen
plugin, then your relaunch buttons become useless?
Shouldn’t Figma hide the relaunch buttons in that case to make easier for the user to understand that they are not compatible in that mode?
Or give them the option to close the codegen
and use the plugin for inspect
(this already happens the other way around).
If not, from the user POV it looks like a bug