I am trying to set an interval task in a function using setInterval(), but the callback function is not being invoked. I have tried using a new Promise and directly calling setInterval but both have issues in accessing outer variables and passing parameters to the API function. Additionally, I need to clear the interval job after a certain number of repeats, but cannot find a way to do that dynamically. It seems to be a bug in the Appsmith platform.
The user is trying to set an interval task within a fulfilled
then() function, but the
setInterval callback is not being invoked. They tried using the
new Promise method, but faced issues accessing outer variables and passing parameters to
Api2.run() inside the callback. It was mentioned that there is a bug preventing outer variable access inside the callback in the current version of the Appsmith platform.
A possible solution was suggested where the user can directly call
setInterval and check for the success condition inside the callback. They can pass
Api2.run() directly. However, the issue of accessing outer variables inside the callback remains. The user can manually limit the number of repeats instead of using a variable.
It was acknowledged that the current bug is causing inconvenience, and the solution to this issue is in progress.