Does anyone have any insight on this?
Could you share a code example?
const ComponentSet=node.mainComponent.parent as ComponentSetNode;
In that example, it works if the component is a local component but if its a component from a team library first the parent is not a componentNodeSet but rather a pageNode. When I run the plugin in the same file as the component that is in a team library it pulls the information with no issue.
Are you sure the instance you selected has a ComponentNodeSet parent? Maybe it’s just a ComponentNode?
Yeah I am sure its a component node I drag the component from the Team library and literally just click it and run the plugin and it shows up as the node.maincomponent.parent is a pagenode rather than a componentSetNode. But When I try the same thing creating an instance of the same component in the local file it was created in it works. I honestly think it’s a bug in Figma because this outcome is not right and I am stumped
Sorry, but I can’t confirm this.
I created a file for you that has 4 component instances (2 from the library and 2 local).
Please duplicate this file and test your plugin against it, then post your results.
Idk what is different I did not change anything with my code but when I open your file it shows the component set and when I went back to my file it now shows as a component set and not a page node… I guess solved? I have screenshots of it as a pagenode no matter what I did.
Oh well I will continue and I will return to this thread if I find the issue again with more insight thank you for your help
In my file, there are only 2 instances whose parent is ComponentSetNode. 2 more instances are instances of individual components that do not have component sets at all. That is, your code (which you provided above) should only print 2 results to the console for instances whose parent is ComponentSetNode.
By the way, I added 2 more instances to the file. And it would be great if you wrote about the results for each instance in order.
Okay here the result individually
- When selected produces nothing in the console.
- When selected nothing is shown in the console.
- Shows property definitions in the console
- Shows property definitions in the console.
1 and 2. Don’t have a ComponentSetNode. The ComponentPropertyDefinitions is at the ComponentNode level.
3 and 4. Have a ComponentSetNode.
5 and 6. Have neither ComponentSetNode nor component properties.
That is, only instances 5 and 6 should have an empty object.