Just a quick snippet about how to do polling the Svelte way.
import { onDestroy } from "svelte"
let interval
const poll = () => {
clearTimeout(interval)
Inertia.reload()
interval = setTimeout(poll, 1000)
}
poll()
onDestroy(() => clearTimeout(interval))
I mean, it could be done differently but the basic idea persists across javascript ecosystem. And the idea is to make sure calls to your function do not compound. This is sort of trap for the young players.
I have been doing polling in Node as well, because the industrial procotol Modbus does it the polling way and it took me a while to understand how to do it right.