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/98-reference/.generated/shared-errors.md
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,43 @@ Certain lifecycle methods can only be used during component initialisation. To f
60
60
<button onclick={handleClick}>click me</button>
61
61
```
62
62
63
+
### snippet_without_render_tag
64
+
65
+
```
66
+
Attempted to render a snippet without a `{@render}` block. This would cause the snippet code to be stringified instead of its content being rendered to the DOM. To fix this, change `{snippet}` to `{@render snippet()}`.
67
+
```
68
+
69
+
A component throwing this error will look something like this (`children` is not being rendered):
70
+
71
+
```svelte
72
+
<script>
73
+
let { children } = $props();
74
+
</script>
75
+
76
+
{children}
77
+
```
78
+
79
+
...or like this (a parent component is passing a snippet where a non-snippet value is expected):
80
+
81
+
```svelte
82
+
<!--- file: Parent.svelte --->
83
+
<ChildComponent>
84
+
{#snippet label()}
85
+
<span>Hi!</span>
86
+
{/snippet}
87
+
</ChildComponent>
88
+
```
89
+
90
+
```svelte
91
+
<!--- file: Child.svelte --->
92
+
<script>
93
+
let { label } = $props();
94
+
</script>
95
+
96
+
<!-- This component doesn't expect a snippet, but the parent provided one -->
Copy file name to clipboardExpand all lines: packages/svelte/messages/shared-errors/errors.md
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,41 @@ Certain lifecycle methods can only be used during component initialisation. To f
52
52
<button onclick={handleClick}>click me</button>
53
53
```
54
54
55
+
## snippet_without_render_tag
56
+
57
+
> Attempted to render a snippet without a `{@render}` block. This would cause the snippet code to be stringified instead of its content being rendered to the DOM. To fix this, change `{snippet}` to `{@render snippet()}`.
58
+
59
+
A component throwing this error will look something like this (`children` is not being rendered):
60
+
61
+
```svelte
62
+
<script>
63
+
let { children } = $props();
64
+
</script>
65
+
66
+
{children}
67
+
```
68
+
69
+
...or like this (a parent component is passing a snippet where a non-snippet value is expected):
70
+
71
+
```svelte
72
+
<!--- file: Parent.svelte --->
73
+
<ChildComponent>
74
+
{#snippet label()}
75
+
<span>Hi!</span>
76
+
{/snippet}
77
+
</ChildComponent>
78
+
```
79
+
80
+
```svelte
81
+
<!--- file: Child.svelte --->
82
+
<script>
83
+
let { label } = $props();
84
+
</script>
85
+
86
+
<!-- This component doesn't expect a snippet, but the parent provided one -->
87
+
<p>{label}</p>
88
+
```
89
+
55
90
## store_invalid_shape
56
91
57
92
> `%name%` is not a store with a `subscribe` method
Copy file name to clipboardExpand all lines: packages/svelte/src/internal/shared/errors.js
+15Lines changed: 15 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,21 @@ export function lifecycle_outside_component(name) {
48
48
}
49
49
}
50
50
51
+
/**
52
+
* Attempted to render a snippet without a `{@render}` block. This would cause the snippet code to be stringified instead of its content being rendered to the DOM. To fix this, change `{snippet}` to `{@render snippet()}`.
53
+
* @returns {never}
54
+
*/
55
+
exportfunctionsnippet_without_render_tag(){
56
+
if(DEV){
57
+
consterror=newError(`snippet_without_render_tag\nAttempted to render a snippet without a \`{@render}\` block. This would cause the snippet code to be stringified instead of its content being rendered to the DOM. To fix this, change \`{snippet}\` to \`{@render snippet()}\`.\nhttps://svelte.dev/e/snippet_without_render_tag`);
0 commit comments