Skip to main content
Question

importComponentByKeyAsync leads to lagging or freezing figma

  • January 12, 2024
  • 1 reply
  • 189 views

111749

When I try to import published component into current file in Figma plugin with importComponentByKeyAsync plugin api, Figma is lagging or even freezing and I’m not able to do any operations (like manually create frame or drag layers around) during the import. It seems that importComponentByKeyAsync is not asynchronous at all. Has anyone experienced this before or has any insights about this problem? Thanks so much.

This topic has been closed for replies.

1 reply

vincy
  • 1 reply
  • September 11, 2024

you need to edit component instance, not the component itself.; like it:
let importComponent = await Figma.importComponentByKeyAsync(‘xxxxxxx’);

  const instance = importComponent.createInstance();
  instance.y = 20;

it will useful