logoalt Hacker News

nixpulvisyesterday at 9:02 PM2 repliesview on HN

I've never used Svelte before, so maybe I'm misunderstanding what they mean by tracking dirty, but this bit confused me.

> This requires the framework to track which components are dirty. Vue does this at runtime, Svelte handles it at compile time.

How can it possibly track this at compile time? Best I could see if tracking where those bits could be set, but not actually setting them.


Replies

Sammiyesterday at 10:11 PM

Svelte version 3 used to statically analyze at compile time which things could change which things and it would build a "direct" reactivity system from that. So kinda both compile time and runtime.

But Svelte 5 changed to use a signals based approach just like Vue and Solidjs, which is runtime based and more flexible. Svelte chose to add some compile time syntax sprinkles on top that they call "runes", because they like a simpler syntax. But signals are fundamentally a runtime concept.

duderificyesterday at 9:55 PM

I was struggling with this too - maybe it means that at compile time, it just flags those nodes in the tree that might become dirty due to state changes, and ignores the rest.