Developers

I have some code that takes some time to run on the client side. What is the best way to provide feedback to the user to wait? When I create a Var.View, modifying the value does not update while the computation is ongoing.

Hi! Do you have your long computation as an async expression? (I am assuming you use F#. If you are interested in C#, please tell and I will give advice for that too.)

JavaScript is single-threaded, so WebSharper is using a round-robin scheduler for running asyncs, regularly yielding so that other JS event handlers can run too. Even if you have your outer computation function as async, if it is calling any function that takes long to execute (for example has large loops), that part will be blocking (preventing any UI updates, including WebSharper.UI reactive logic). So all potentionally long-running functions should be written as an async. Having loops inside an async expression, F# automatically breaks it down so it is yielding control after every iteration.