Skip to content

Commit b931ab8

Browse files
committed
docs: document more breaking changes
Related to #11400 closes #11590
1 parent 6f28e41 commit b931ab8

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

sites/svelte-5-preview/src/routes/docs/content/03-appendix/02-breaking-changes.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,25 @@ In Svelte 4 syntax, every property (declared via `export let`) is bindable, mean
133133

134134
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.
135135

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:
143+
144+
```svelte
145+
<script>
146+
let foo = new Foo();
147+
</script>
148+
149+
<button on:click={() => (foo.value = 1)}>{foo.value}</button
150+
>
151+
```
152+
153+
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+
136155
## Other breaking changes
137156

138157
### Stricter `@const` assignment validation
@@ -158,9 +177,9 @@ In the event that you need to support ancient browsers that don't implement `:wh
158177
css = css.replace(/:where\((.+?)\)/, '$1');
159178
```
160179

161-
### Renames of various error/warning codes
180+
### Error/warning codes have been renamed
162181

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.
164183

165184
### Reduced number of namespaces
166185

@@ -203,3 +222,11 @@ Previously, bindings did not take into account `reset` event of forms, and there
203222
### `walk` not longer exported
204223

205224
`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

Comments
 (0)