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
fixes#14532
This removes the `reactive_declaration_non_reactive_property` warning altogether. The first version caused many false positives at compile time. The refined runtime version (introduced in #14192) was hoped to fix this, but it turns out we now get loads of false positives at runtime.
Copy file name to clipboardExpand all lines: documentation/docs/98-reference/.generated/client-warnings.md
-40
Original file line number
Diff line number
Diff line change
@@ -204,46 +204,6 @@ Consider the following code:
204
204
205
205
To fix it, either create callback props to communicate changes, or mark `person` as [`$bindable`]($bindable).
206
206
207
-
### reactive_declaration_non_reactive_property
208
-
209
-
```
210
-
A`$:`statement (%location%) read reactive state that was not visible to the compiler. Updates to this state will not cause the statement to re-run. The behaviour ofthis code will change if you migrate it to runes mode
211
-
```
212
-
213
-
In legacy mode, a `$:` [reactive statement](https://svelte.dev/docs/svelte/legacy-reactive-assignments) re-runs when the state it _references_ changes. This is determined at compile time, by analysing the code.
214
-
215
-
In runes mode, effects and deriveds re-run when there are changes to the values that are read during the function's _execution_.
216
-
217
-
Often, the result is the same — for example these can be considered equivalent:
218
-
219
-
```js
220
-
let a =1, b =2, sum =3;
221
-
// ---cut---
222
-
$: sum = a + b;
223
-
```
224
-
225
-
```js
226
-
let a =1, b =2;
227
-
// ---cut---
228
-
constsum=$derived(a + b);
229
-
```
230
-
231
-
In some cases — such as the one that triggered the above warning — they are _not_ the same:
232
-
233
-
```js
234
-
let a =1, b =2, sum =3;
235
-
// ---cut---
236
-
constadd= () => a + b;
237
-
238
-
// the compiler can't 'see' that `sum` depends on `a` and `b`, but
239
-
// they _would_ be read while executing the `$derived` version
240
-
$: sum =add();
241
-
```
242
-
243
-
Similarly, reactive properties of [deep state](https://svelte.dev/docs/svelte/$state#Deep-state) are not visible to the compiler. As such, changes to these properties will cause effects and deriveds to re-run but will _not_ cause `$:` statements to re-run.
244
-
245
-
When you [migrate this component](https://svelte.dev/docs/svelte/v5-migration-guide) to runes mode, the behaviour will change accordingly.
Copy file name to clipboardExpand all lines: packages/svelte/messages/client-warnings/warnings.md
-38
Original file line number
Diff line number
Diff line change
@@ -170,44 +170,6 @@ Consider the following code:
170
170
171
171
To fix it, either create callback props to communicate changes, or mark `person` as [`$bindable`]($bindable).
172
172
173
-
## reactive_declaration_non_reactive_property
174
-
175
-
> A `$:` statement (%location%) read reactive state that was not visible to the compiler. Updates to this state will not cause the statement to re-run. The behaviour of this code will change if you migrate it to runes mode
176
-
177
-
In legacy mode, a `$:` [reactive statement](https://svelte.dev/docs/svelte/legacy-reactive-assignments) re-runs when the state it _references_ changes. This is determined at compile time, by analysing the code.
178
-
179
-
In runes mode, effects and deriveds re-run when there are changes to the values that are read during the function's _execution_.
180
-
181
-
Often, the result is the same — for example these can be considered equivalent:
182
-
183
-
```js
184
-
let a =1, b =2, sum =3;
185
-
// ---cut---
186
-
$: sum = a + b;
187
-
```
188
-
189
-
```js
190
-
let a =1, b =2;
191
-
// ---cut---
192
-
constsum=$derived(a + b);
193
-
```
194
-
195
-
In some cases — such as the one that triggered the above warning — they are _not_ the same:
196
-
197
-
```js
198
-
let a =1, b =2, sum =3;
199
-
// ---cut---
200
-
constadd= () => a + b;
201
-
202
-
// the compiler can't 'see' that `sum` depends on `a` and `b`, but
203
-
// they _would_ be read while executing the `$derived` version
204
-
$: sum =add();
205
-
```
206
-
207
-
Similarly, reactive properties of [deep state](https://svelte.dev/docs/svelte/$state#Deep-state) are not visible to the compiler. As such, changes to these properties will cause effects and deriveds to re-run but will _not_ cause `$:` statements to re-run.
208
-
209
-
When you [migrate this component](https://svelte.dev/docs/svelte/v5-migration-guide) to runes mode, the behaviour will change accordingly.
210
-
211
173
## state_proxy_equality_mismatch
212
174
213
175
> Reactive `$state(...)` proxies and the values they proxy have different identities. Because of this, comparisons with `%operator%` will produce unexpected results
Copy file name to clipboardExpand all lines: packages/svelte/src/internal/client/warnings.js
-12
Original file line number
Diff line number
Diff line change
@@ -155,18 +155,6 @@ export function ownership_invalid_mutation(component, owner) {
155
155
}
156
156
}
157
157
158
-
/**
159
-
* A `$:` statement (%location%) read reactive state that was not visible to the compiler. Updates to this state will not cause the statement to re-run. The behaviour of this code will change if you migrate it to runes mode
console.warn(`%c[svelte] reactive_declaration_non_reactive_property\n%cA \`$:\` statement (${location}) read reactive state that was not visible to the compiler. Updates to this state will not cause the statement to re-run. The behaviour of this code will change if you migrate it to runes mode\nhttps://svelte.dev/e/reactive_declaration_non_reactive_property`,bold,normal);
* Reactive `$state(...)` proxies and the values they proxy have different identities. Because of this, comparisons with `%operator%` will produce unexpected results
Copy file name to clipboardExpand all lines: packages/svelte/tests/runtime-legacy/samples/reactive-statement-non-reactive-import-statement/data.svelte.js
0 commit comments