Skip to main content
Astrosias
Nov 18, 2024 12:37 AM UTC
Solved

How to add nodes to existing group?

Hi,

I’m writing a plugin that creates a group of nodes. But due to the number of nodes to create (around 100 000) and in order to avoid OutOfMemory errors, I need to do it in batch of 1000.

I currently create a group this way:

  var myGroupNode = figma.group(myInstanceNodes, figma.currentPage)
  myGroupNode.name = "Plugin created group "
  myGroupNode.locked = true

But I can’t find a way to add new nodes inside the group after it’s creation, so I end up with 100 groups of 1000 nodes instead of a single group of 100 000 nodes.

How can I achive this ?

This topic has been closed for replies.
tank666
tank666Solution
Nov 18, 2024 5:36 AM UTC
figma.com
UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank

2 replies

tank666
tank666Solution
Nov 18, 2024 5:36 AM UTC
UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Astrosias
AstrosiasAuthor
Dec 20, 2024 10:40 AM UTC

Thanks for the anwser, and sorry for replying a month later.

For anyone stumbling on this while trying to do the same thing (adding 10s of thousands of nodes), remember that a default chromium will die at some point if your project reaches the hundreds of MB.
In the end, I had to create a separate png out of these nodes, and import it afterward.