Hi Figma community/team! Wondering if anyone has any context on this strange selection lag issue I run into when selecting component instance nodes:
- Our plugin listens to selection events via
selectionchangeevent (docs) - On selection change, we want to evaluate
figma.currentPage.selectionand perform some calcuations - This works fine and well, EXCEPT for the case where the current Figma selection includes component instance nodes
- In that case, when the user selects a component instance node directly, the selection of the comp instance node lags (see video-- there's a lag as the selection boundary "flashes" when selecting an instance node, VS no lag when selecting a frame node)
- But what's odd is that if I select a parent node containing that same comp instance node, e.g. a frame, there is no lag
I can consistently reproduce this laggy selection with the simple code below. It appears any reference to figma.currentPage.selection in the selection event handler causes the performance to dip when selecting comp nodes. Is this a known issue? Why might this be the case? And are there any workarounds for this issue? This is a key part of our plugin's functionality (we need to evaluate the current selection on selection change), and we want to make the experience smooth for our users working with component instances.
figma.on("selectionchange", () => { console.log(figma.currentPage.selection) })
crosspost question from discord (which has screen recording)-- posting for visibility
