How do you search for a node within a page?

Are you using Figma.getNodeById() which search through the entire document, or using Figma.currentPage ?

I noticed that in big documents with lots of pages getNodeById is slow

I don’t often use getnodebyid to avoid searching the whole document. How are you using this function? Using currentpage is much better as long as you know the node you are searching for is indeed on the current page.

1 Like

So we are using getNodeById when we need some data from that node. i see that the return type (Base Node) is different from findOne (Scene node). does it matter?

Basically I’m using the node id to search it, so I can do the same wit findOne?

I mean usually I conceptually change the plugin to avoid get by id and similar functions, e.g. ask the user to select the node manually if the plugin is ok with that or store necessary data in the client storage instead of on the node, or if I need to find multiple nodes I search for all of them at once instead of using find by id on each one separately. Just some ideas, you didn’t explain what you are using it for so I can’t suggest anything concrete.

No, it doesn’t matter.

Sure.