Unable to get detached info

I am developing a codegen plugin and would like to process detached components.
If I paste a component from remote library and detach it, detachedInfo property contains {type: 'local', componentId: '-1:-1'} so I can’t get any data about main component. However, Figma itself keeps link to main component as I can see it in the interface.

Hi, thanks for bringing this up. We plan to roll out a fix to the detachedInfo property by the end of day this Wednesday October 11. It’s supposed to give you the component key for remote components.

1 Like

Hi! I see that now detachedInfo correctly contains component key, thanks. One more question: how can I use this key in dev-mode? If I try figma.importComponentByKeyAsync, I receive error Can't call "importComponentByKeyAsync" in read-only mode

You can’t use figma.importComponentByKeyAsync in dev mode because it modifies the file, and dev mode plugins are read-only.

If you have an instance node that you need to get the component for, you can just use instanceNode.mainComponent: InstanceNode | Plugin API

It seems that I can’t use detachedInfo in case of remote components in dev mode. Is there any possibility to find out what was original component for detached node in dev mode? Maybe detachedInfo could return ComponentNode itself, not just key?

1 Like

I have the same issue.