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: sites/svelte-5-preview/src/routes/docs/content/03-appendix/02-breaking-changes.md
+29-2Lines changed: 29 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -133,6 +133,25 @@ In Svelte 4 syntax, every property (declared via `export let`) is bindable, mean
133
133
134
134
Setting the `accessors` option to `true` makes properties of a component directly accessible on the component instance. In runes mode, properties are never accessible on the component instance. You can use component exports instead if you need to expose them.
135
135
136
+
### `immutable` option is ignored
137
+
138
+
Setting the `immutable` option has no effect in runes mode. This concept is replaced by how `$state` and its variations work.
139
+
140
+
### Classes are no longer "auto-reactive"
141
+
142
+
In Svelte 4, doing the following triggered reactivity:
The reason is that Svelte statically saw the reassignment and used is a hint to trigger a rerender. In runes mode, just wrapping the class with `$state` doesn't make it reactive. The reason is that reactivity is now runtime-based, and classes are left untouched. To make that code reactive, you instead need to make the `value` on `Foo``$state`.
154
+
136
155
## Other breaking changes
137
156
138
157
### Stricter `@const` assignment validation
@@ -158,9 +177,9 @@ In the event that you need to support ancient browsers that don't implement `:wh
158
177
css =css.replace(/:where\((.+?)\)/, '$1');
159
178
```
160
179
161
-
### Renames of various error/warning codes
180
+
### Error/warning codes have been renamed
162
181
163
-
Various error and warning codes have been renamed slightly.
182
+
Error and warning codes have been renamed. Previously they used dashes to separate the words, they now use underscores (e.g. foo-bar becomes foo_bar). Additionally, a handful of codes have been reworded slightly.
164
183
165
184
### Reduced number of namespaces
166
185
@@ -203,3 +222,11 @@ Previously, bindings did not take into account `reset` event of forms, and there
203
222
### `walk` not longer exported
204
223
205
224
`svelte/compiler` reexported `walk` from `estree-walker` for convenience. This is no longer true in Svelte 5, import it directly from that package instead in case you need it.
225
+
226
+
### Content inside `svelte:options` is forbidden
227
+
228
+
In Svelte 4 you could have content inside a `<svelte:options />` tag. It was ignored, but you could write something in there. In Svelte 5, content inside that tag is a compiler error.
229
+
230
+
### Slots inside templates are preserved
231
+
232
+
Svelte 4 replaced the `<slot />` tag in all places with its own version of slots. Svelte 5 preserves them in the case they are a child of a `<template shadowrootmode="...">` element.
0 commit comments