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/04-runtime/04-imperative-component-api.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,8 @@ const app = mount(App, {
29
29
30
30
You can mount multiple components per page, and you can also mount from within your application, for example when creating a tooltip component and attaching it to the hovered element.
31
31
32
+
Note that unlike calling `new App(...)` in Svelte 4, things like effects (including `onMount` callbacks, and action functions) will not run during `mount`. If you need to force pending effects to run (in the context of a test, for example) you can do so with `flushSync()`.
33
+
32
34
## `unmount`
33
35
34
36
Unmounts a component created with [`mount`](#mount) or [`hydrate`](#hydrate):
@@ -74,3 +76,5 @@ const app = hydrate(App, {
74
76
props: { some:'property' }
75
77
});
76
78
```
79
+
80
+
As with `mount`, effects will not run during `hydrate` — use `flushSync()` immediately afterwards if you need them to.
Copy file name to clipboardExpand all lines: sites/svelte-5-preview/src/routes/docs/content/01-api/05-imports.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,8 @@ const app = mount(App, {
44
44
});
45
45
```
46
46
47
+
Note that unlike calling `new App(...)` in Svelte 4, things like effects (including `onMount` callbacks, and action functions) will not run during `mount`. If you need to force pending effects to run (in the context of a test, for example) you can do so with `flushSync()`.
48
+
47
49
### `hydrate`
48
50
49
51
Like `mount`, but will reuse up any HTML rendered by Svelte's SSR output (from the [`render`](#svelte-server-render) function) inside the target and make it interactive:
@@ -59,6 +61,8 @@ const app = hydrate(App, {
59
61
});
60
62
```
61
63
64
+
As with `mount`, effects will not run during `hydrate` — use `flushSync()` immediately afterwards if you need them to.
65
+
62
66
### `unmount`
63
67
64
68
Unmounts a component created with [`mount`](#svelte-mount) or [`hydrate`](#svelte-hydrate):
0 commit comments