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: src/routes/reference/lifecycle/on-cleanup.mdx
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,6 +51,7 @@ Returns `fn` unchanged.
51
51
- In a component, the cleanup runs when that component is unmounted.
52
52
- In a tracking scope such as [`createEffect`](/reference/basic-reactivity/create-effect), [`createMemo`](/reference/basic-reactivity/create-memo), or [`createRoot`](/reference/reactive-utilities/create-root), the cleanup runs when that scope is disposed or re-executes.
53
53
- Multiple cleanup functions run when the owning scope is cleaned up.
54
+
- Calling `onCleanup` outside a reactive owner does not register a cleanup. In development, Solid warns that the cleanup will never run.
54
55
- On the server, cleanup also runs when server-side owners or reactive branches are disposed.
Copy file name to clipboardExpand all lines: src/routes/reference/lifecycle/on-mount.mdx
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,7 @@ Non-tracking function executed once on mount.
49
49
-`fn` does not track reactive dependencies.
50
50
- Internally, `onMount(fn)` is equivalent to `createEffect(() => untrack(fn))`.
51
51
- By the time `onMount` runs, refs have already been assigned.
52
+
- Returning a function from `fn` does not register cleanup. Use [`onCleanup`](/reference/lifecycle/on-cleanup) inside `onMount` when cleanup is needed.
Copy file name to clipboardExpand all lines: src/routes/reference/secondary-primitives/create-deferred.mdx
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,6 +78,7 @@ Returns an accessor that exposes the deferred value.
78
78
- The deferred accessor initially reflects the current source value.
79
79
- Later updates are deferred through Solid's scheduler until later execution or until `timeoutMs` is reached, so the returned accessor can lag behind the source accessor.
80
80
-`equals` controls whether downstream dependents are notified for a new value.
81
+
-`createDeferred` defers propagation of the accessor value. It does not debounce writes to the source accessor.
81
82
- On the server, `createDeferred` returns the source accessor unchanged.
Copy file name to clipboardExpand all lines: src/routes/reference/secondary-primitives/create-render-effect.mdx
+20-60Lines changed: 20 additions & 60 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,12 +12,11 @@ tags:
12
12
- lifecycle
13
13
version: "1.0"
14
14
description: >-
15
-
Execute effects immediately during rendering with createRenderEffect. Run side
16
-
effects as DOM creates, before refs are set or connected.
15
+
Create a reactive computation that runs immediately during the render phase.
17
16
---
18
17
19
-
The `createRenderEffect`primitive creates a reactive computation that automatically tracks reactive values, such as [signals](/concepts/signals), accessed within the provided function.
20
-
This function re-runs whenever any of its dependencies change.
18
+
`createRenderEffect` creates a reactive computation that runs during the render phase as DOM is created and updated.
19
+
It tracks reactive reads inside the provided function and re-runs whenever those dependencies change.
21
20
22
21
## Execution Timing
23
22
@@ -30,15 +29,12 @@ This function re-runs whenever any of its dependencies change.
30
29
### Subsequent Runs
31
30
32
31
- After the initial render, the render effect **re-runs whenever any of its tracked dependencies change**.
33
-
- Re-runs occur **after** all pure computations (such as [memos](/concepts/derived-values/memos)) have completed within the same update cycle.
34
32
- When multiple dependencies change within the same batch, the render effect **runs once per batch**.
35
-
- The **order of re-runs** among multiple render effects is **not guaranteed**.
36
33
37
34
### Server-Side Rendering
38
35
39
36
- During SSR, render effects **run once on the server**, since they are part of the synchronous rendering phase.
40
-
- On the client, an initial run still occurs during the client rendering phase to initialize the reactive system;
41
-
that client initial run is separate from the server run.
37
+
- On the client, an initial run still occurs during the client rendering phase.
42
38
- After hydration, subsequent runs occur on the client when dependencies change.
43
39
44
40
## Import
@@ -69,7 +65,7 @@ function createRenderEffect<Next, Init>(
-`createRenderEffect` runs immediately when it is created.
104
+
- Its initial run happens during the render phase, before mounted DOM is connected and before refs are assigned.
105
+
- Later runs happen when tracked dependencies change.
106
+
- Most application code should use [`createEffect`](/reference/basic-reactivity/create-effect). `createRenderEffect` is mainly for render-phase work where that timing is required.
114
107
115
-
// This runs immediately during render, and re-runs when the count changes.
0 commit comments