When I use the example in waitForTask doc the widget doesn’t stop rendering
const { widget } = figma
const { Text, useEffect, waitForTask, useSyncedState } = widget
function WaitForTaskExample() {
const ttextContent, setTextContent] = useSyncedState("text", "Initial")
useEffect(() => {
waitForTask(new Promise(resolve => {
// Simulate async work
setTimeout(() => {
setTextContent("Final")
// Resolve the task
resolve()
}, 1000)
}))
})
return <Text>{textContent}</Text>
}
widget.register(WaitForTaskExample)
On the setTextContent the widget seems to restart and rendering again and again