Skip to main content
Question

Remove all instances node not working on a specific file


Floran

Hello !
I created a plugin dedicated to hide/show some instances in a file or in the current page.
I currently try to do it with two instances, based on the name of the ComponentNode linked.

This is how it looks like :
image

“Specs markers” instances can be deleted without any issue on my document and on another document.
“UXW markers” instances can be deleted on my document, but on another document I have an error :

Removing this node is not allowed

Which is weird because the script does exactly the same thing, and it’s working on my test file.

Do you have any idea of what can be the reason ?

This is how it works basically :

instances = figma.root.findAll( node => node.mainComponent && node.mainComponent.remote && node.mainComponent.parent && node.mainComponent.parent.name === target);
instances.forEach ( instance => instance.remove());

4 replies

tank666
  • 4859 replies
  • March 13, 2023

Are you trying to remove a nested instance in some component instance? Removing is possible only in the main component.


Floran
  • Author
  • 21 replies
  • March 13, 2023

Of course no, this instance is not nested inside another component. I can remove it manually so I should be able to do it with the plugin


tank666
  • 4859 replies
  • March 13, 2023

Could you share a link to the file?


Floran
  • Author
  • 21 replies
  • March 13, 2023

Unfortunately, I’m not able to share a link because I have this issue on a work file.
But I just discovered by exploring it that in the page, there is a component with the instance in it. I guess this only case leads to an error for the whole script.

That means, I need to find a way before the delete command to select only instances that are not part of another instance. I will investigate on how to do it.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings