So I’ve noticed that when using actions with only JavaScript steps in the “Show Loading” setting of components, and the code is all synchronous, the loading never actually shows/updates properly.
For example, here is an action that calculates the factorial of the numbers 0 to 9999:
var f = [];
function factorial (n) {
if (n == 0 || n == 1)
return 1;
if (f[n] > 0)
return f[n];
return f[n] = factorial(n-1) * n;
}
const ret = Array(10000).fill(null).map((_,i) => factorial(i));
return ret;
On average, it takes around 0.5 ms, which is not a lot, but it should still show the loading on the component for a very brief moment, but it doesn’t:

But if we add something asynchronous to the action, it does show. For example, I’ll add await new Promise(r => setTimeout(r,0)); at the very beginning. Now the loading state is visible:

I have other examples, but I think my issue is clear. This makes it quite bothersome to work with loading states, since it requires you to have at least one asynchronous operations in actions you’ll use for the Show Loading setting.
Maybe I’m also doing something wrong?