Set Timeout Example
I want to update a single every x seconds in a component. Are there any examples of this I can look at? Right now this is my approach, but it is not working. I can't seem to find any examples anywhere.
6 Replies
sth like this?
also return count like this
or
count()
executes the signal and return the value, but if noone is listening, nothing will update when it changesYes, ty. In my app web I try that I get this message
dev.js:736 computations created outside a 'createRoot' or 'render' will never be disposed
. Any ideas on why? I have a similar structure to my example above.
The exact code for that is
is the
onMount
top-level? that's the only computation in the picture
is the onMount top-levelor differently, is it declared in a component or not
It is declared in a component. Sorry I should have specified.
I don't see any issues here
if you comment out the onMount, does the warning go away?
also you probably can follow the stack trace of the warning
Uncommenting didn't fix it. My error is probably somewhere else then. The trace goes there first and the error appears every time the interval fires. It might have something to do with my images. Thanks for your help.
Ok, so I figured it out, and you were right. The issue isn't in the code above. I was wrapping each of my images with a component. When I cut that out and just used an
img
the warning went away, Not really for sure why, but it is officially gone. Thanks for your help!