Hello, I am a junior developer preparing to deploy a plugin. I look forward to your support.
My plugin creates nodes and stores their IDs. When the user closes the plugin, I use the figma.onClose()
event listener to detect the close event and then use the getNodeById
API to find and delete the nodes created by the plugin.
After adding documentAccess: dynamic-page
in the manifest.json to prepare for deployment, I encountered a warning stating, “Error in getNodeById
: Cannot call with documentAccess: dynamic-page
. Use figma.getNodeByIdAsync
instead.” Therefore, I switched to getNodeByIdAsync
, but then I found out from the link below that asynchronous functions do not work within the callback of figma.onClose()
.
I am curious about how to resolve this issue. If there is no solution, I would like to know what other methods I could use to delete the nodes created by my plugin.
https://www.figma.com/plugin-docs/api/properties/figma-on/#close