Signal value not updating from inside of `for await of` loop inside of an IIFE
I'm using an IIFE here because otherwise the
for await of loop will block the code and page keeps loading till WebSocketStream connection ends, so I did that.But why does setting
message.value = msg not update the button text, it is stuck at the initial Connecting text.But when I set
message.value = 'updated outside of the IIFE' then it works fine, the value is updating as expected.The
console.log(msg) inside the IIFE's for await of loop also works and logs the msg to the console, but still message.value = msg doesn't. Why ??