You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/docs/02-runes/03-$derived.md
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -45,3 +45,9 @@ Sometimes you need to create complex derivations that don't fit inside a short e
45
45
```
46
46
47
47
In essence, `$derived(expression)` is equivalent to `$derived.by(() => expression)`.
48
+
49
+
## Understanding dependencies
50
+
51
+
Anything read synchronously inside the `$derived` expression (or `$derived.by` function body) is considered a _dependency_ of the derived state. When the state changes, the derived will be marked as _dirty_ and recalculated when it is next read.
52
+
53
+
To exempt a piece of state from being treated as a dependency, use [`untrack`](svelte#untrack).
0 commit comments