Inner workings of "when do"?

Hi!

I’m new to Kodular so please go easy on me. I’m mostly used to write C but have some experience JAVA and Python however I’m completely new at the drag n drop scene.
I’ve been trying to figure out the inner working of the “when btn clicked do” functionality.

As you see in the first picture I want to show progress and hide list then do the operation and after operation I want to hide progress and show list.
However this seems to do the whole do block and then update screen. The progress never shows. However if I do like the second picture it does work.

Now I have a more complex loop as well which is using a short delay between every iteration and the screen seems to actually update after every iteration in that case.

Does anyone know how it actually works? Is there a way to force it to update screen at some point so that I don’t have to use the example from the second picture? It might work in this case but is not optimal.

Appreciate any input…
Thanks