gotcha

/ 1 min read

The $effect Trap

If you're building anything real-time in Svelte 5 — SSE, WebSockets, polling — you will probably hit this. The Setup You have a reactive state object and an $effect that sets up a listener. The listener pushes new data into the state: let data = $state({ messages: [] }); $effect(() => { const source