Reactivity resulting from updates in a websocket event listener
I am struggling to understand why setting a signal in an event listener is not driving re-rendering for the signal. In the code below I observe reactivity for
count2
(that is set in the setInterval callback), but not for count
(that is set when a message is received on the websocket).
I can see from the console.log
in the message event handler that the values passed to setCount
are changing. So my expectation is that the rendered value should change.
I don't doubt that the reason for this is covered somewhere in the docs. I suspect that I'm simply misreading or misunderstanding something.
1 Reply
It probably doesn't help that I've struggled to find the right search terms when looking in the docs and in discord.
Solved : The problem was completely unrelated to Solid, and entirely down to my own silliness. The type of
ev.data
is a string, and I was coercing it to an object.