|
| 1 | +### binding_property_non_reactive |
| 2 | + |
| 3 | +``` |
| 4 | +`%binding%` is binding to a non-reactive property |
| 5 | +``` |
| 6 | + |
| 7 | +``` |
| 8 | +`%binding%` (%location%) is binding to a non-reactive property |
| 9 | +``` |
| 10 | + |
| 11 | +### console_log_state |
| 12 | + |
| 13 | +``` |
| 14 | +Your `console.%method%` contained `$state` proxies. Consider using `$inspect(...)` or `$state.snapshot(...)` instead |
| 15 | +``` |
| 16 | + |
| 17 | +When logging a [proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy), browser devtools will log the proxy itself rather than the value it represents. In the case of Svelte, the 'target' of a `$state` proxy might not resemble its current value, which can be confusing. |
| 18 | + |
| 19 | +The easiest way to log a value as it changes over time is to use the [`$inspect`](https://svelte-5-preview.vercel.app/docs/runes#$inspect) rune. Alternatively, to log things on a one-off basis (for example, inside an event handler) you can use [`$state.snapshot`](https://svelte-5-preview.vercel.app/docs/runes#$state-snapshot) to take a snapshot of the current value. |
| 20 | + |
| 21 | +### event_handler_invalid |
| 22 | + |
| 23 | +``` |
| 24 | +%handler% should be a function. Did you mean to %suggestion%? |
| 25 | +``` |
| 26 | + |
| 27 | +### hydration_attribute_changed |
| 28 | + |
| 29 | +``` |
| 30 | +The `%attribute%` attribute on `%html%` changed its value between server and client renders. The client value, `%value%`, will be ignored in favour of the server value |
| 31 | +``` |
| 32 | + |
| 33 | +### hydration_html_changed |
| 34 | + |
| 35 | +``` |
| 36 | +The value of an `{@html ...}` block changed between server and client renders. The client value will be ignored in favour of the server value |
| 37 | +``` |
| 38 | + |
| 39 | +``` |
| 40 | +The value of an `{@html ...}` block %location% changed between server and client renders. The client value will be ignored in favour of the server value |
| 41 | +``` |
| 42 | + |
| 43 | +### hydration_mismatch |
| 44 | + |
| 45 | +``` |
| 46 | +Hydration failed because the initial UI does not match what was rendered on the server |
| 47 | +``` |
| 48 | + |
| 49 | +``` |
| 50 | +Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near %location% |
| 51 | +``` |
| 52 | + |
| 53 | +### invalid_raw_snippet_render |
| 54 | + |
| 55 | +``` |
| 56 | +The `render` function passed to `createRawSnippet` should return HTML for a single element |
| 57 | +``` |
| 58 | + |
| 59 | +### lifecycle_double_unmount |
| 60 | + |
| 61 | +``` |
| 62 | +Tried to unmount a component that was not mounted |
| 63 | +``` |
| 64 | + |
| 65 | +### ownership_invalid_binding |
| 66 | + |
| 67 | +``` |
| 68 | +%parent% passed a value to %child% with `bind:`, but the value is owned by %owner%. Consider creating a binding between %owner% and %parent% |
| 69 | +``` |
| 70 | + |
| 71 | +### ownership_invalid_mutation |
| 72 | + |
| 73 | +``` |
| 74 | +Mutating a value outside the component that created it is strongly discouraged. Consider passing values to child components with `bind:`, or use a callback instead |
| 75 | +``` |
| 76 | + |
| 77 | +``` |
| 78 | +%component% mutated a value owned by %owner%. This is strongly discouraged. Consider passing values to child components with `bind:`, or use a callback instead |
| 79 | +``` |
| 80 | + |
| 81 | +### state_proxy_equality_mismatch |
| 82 | + |
| 83 | +``` |
| 84 | +Reactive `$state(...)` proxies and the values they proxy have different identities. Because of this, comparisons with `%operator%` will produce unexpected results |
| 85 | +``` |
| 86 | + |
| 87 | +`$state(...)` creates a [proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) of the value it is passed. The proxy and the value have different identities, meaning equality checks will always return `false`: |
| 88 | + |
| 89 | +```svelte |
| 90 | +<script> |
| 91 | + let value = { foo: 'bar' }; |
| 92 | + let proxy = $state(value); |
| 93 | +
|
| 94 | + value === proxy; // always false |
| 95 | +</script> |
| 96 | +``` |
| 97 | + |
| 98 | +To resolve this, ensure you're comparing values where both values were created with `$state(...)`, or neither were. Note that `$state.raw(...)` will _not_ create a state proxy. |
0 commit comments