Potential $effect.server rune?
#17387
Replies: 1 comment 1 reply
-
|
Currently, there is no reactivity on the server; all |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I've had a few projects recently using
adapter-nodewhere I'm using either streaming requests or websockets, and when state changes I need to push updates to connected clients. I get all excited to use runes, before remembering that$effectand$effect.rootdon't run on the server 🥲. I'm currently using old subscriber functions instead, and it's a much worse experience (It really shows how nice runes are by comparison!).I've been wondering if it would be possible (or even a good idea?) to create an
$effect.serverrune. I imagine it using it like this:It would ONLY run on the server, and it returns a dispose function just like
$effect.root, so it would not need to be wrapped in a root like$effectdoes. This probably wouldn't be a good idea for platforms that aren'tadapter-node, so I guess in those cases it might get transformed into a no-op?Still not sure if it's a great idea.
$effectis already a footgun so adding another effect rune shouldn't be done carelessly, but it would be really nice to be able to have server-side reactivity with runes 😅Beta Was this translation helpful? Give feedback.
All reactions