Guidance on isServer vs onMount
I've got this utility function to create a debounced signal. From the server-side, I don't want to be setting timeouts. My first approach used isServer, but I also found that putting createEffect inside of an onMount gave similar behavior. Which of these is the most "solid"? Or maybe I shouldn't worry about this at all since I have the onCleanup?
isServer version:
onMount version:
3 Replies
You are correct, no createEffect/onMount will run on the server. Afaik your code should also work without the onMount.
onMount(...)
=== createEffect(() => untrack(...))
conceptually speakingAhhh, I see. This cleans up a bunch of my conditionals. Thanks!
You are very welcome!