Skip to main content
111749
Jan 12, 2024 3:24 AM UTC
Question

importComponentByKeyAsync leads to lagging or freezing figma

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
Sep 11, 2024 12:40 PM UTC

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