Hey !
I would like to do something on every instance of a same component, coming from an external library.
Let’s say the component is named “XYZ” and has multiple variants.
I know that I need to use *instance*.mainComponent.parent.name
to get the name of the component, because if not it gives the name of the variant (xxx = xxx, yyy = yyy …)
But when I use it as a search criteria, it’s not working :
const instances = figma.root.findAll( elem => elem.mainComponent.parent.name === "Spec guides");
I get the error :
Error : “findAll” callback crashed: TypeError: cannot read property ‘parent’ of undefined
How to do it properly? 🙂 Thanks !
PS : I tried to use the name of the instance. It’s working, but sometimes we rename the instance so it won’t work in this case…