Skip to main content
Question

Text Review Plug-in timeout

  • December 28, 2022
  • 7 replies
  • 588 views

scanning

Hi,

Is there an amount of time that the ‘textreview’ callback must return within? I notice that if I don’t return any result within 3 seconds, I receive the following error:

Error: Text review plugins must call on('textreview') upon running

The logic of my plugin is as follows:

figma.on('textreview', async ({ text }) => {
   // Send message to UI to instantiate a websocket that receives text review suggestions
   // Register figma.ui.onmessage handler to receive text suggestions and websocket status from UI
   // await for 'idle' response from websocket running within the UI
   // return suggestions
}

At first I thought the issue was my handler receiving messages but then realised I get the same message if I wait on the plugin callback message for longer than 3s.

-Simon

7 replies

James_Cash

Hey @scanning

Did you figure this out? I’m running into the same issue now!


scanning
  • Author
  • 3 replies
  • January 10, 2023

@James_Cash Not yet. I opened a support ticket with Figma yesterday but haven’t heard back yet. I’ll be sure to update this post when I do.


Michael_Yong
Figmate

Hi @scanning, I work on the Plugin API at figma and I can confirm that our current timeout is 3s as you’ve discovered 😅

Thanks for flagging this - we’ll update the documentation to reflect this to avoid future confusion.

Relatedly, I’m curious if you have a use case that requires more than 3s to respond here?


scanning
  • Author
  • 3 replies
  • January 10, 2023

@Michael_Yong I’m sending text for checking via a websocket connection. That takes time to establish and then depending on the length of the text, various suggestions will come back and fire a callback. The number of suggestions is non-deterministic and I have to wait for a timeout period for the websocket to become idle before I can definitively return suggestions or not.


Michael_Yong
Figmate

Quick update: We’re going to change this so that we don’t timeout if the callback takes longer than 3s. The only requirement is that “Text review plugins must call on(‘textreview’) upon running”!

Thanks for flagging this!


scanning
  • Author
  • 3 replies
  • January 23, 2023

Thanks for the update @Michael_Yong. Is there a specific release that removes the 3s requirement? Let me know because I’d like to test and get my plug-in working. Thanks!


Michael_Yong
Figmate

@scanning this should be out now!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings