Skip to content

Commit 38750eb

Browse files
Sync svelte docs (#1304)
sync svelte docs Co-authored-by: svelte-docs-bot[bot] <196124396+svelte-docs-bot[bot]@users.noreply.github.com>
1 parent 8834d29 commit 38750eb

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

apps/svelte.dev/content/docs/svelte/98-reference/.generated/shared-errors.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,43 @@ Certain lifecycle methods can only be used during component initialisation. To f
6060
<button onclick={handleClick}>click me</button>
6161
```
6262

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 -->
97+
<p>{label}</p>
98+
```
99+
63100
### store_invalid_shape
64101

65102
```

apps/svelte.dev/content/docs/svelte/98-reference/30-runtime-errors.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,43 @@ Certain lifecycle methods can only be used during component initialisation. To f
244244
<button onclick={handleClick}>click me</button>
245245
```
246246

247+
### snippet_without_render_tag
248+
249+
```
250+
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()}`.
251+
```
252+
253+
A component throwing this error will look something like this (`children` is not being rendered):
254+
255+
```svelte
256+
<script>
257+
let { children } = $props();
258+
</script>
259+
260+
{children}
261+
```
262+
263+
...or like this (a parent component is passing a snippet where a non-snippet value is expected):
264+
265+
```svelte
266+
<!--- file: Parent.svelte --->
267+
<ChildComponent>
268+
{#snippet label()}
269+
<span>Hi!</span>
270+
{/snippet}
271+
</ChildComponent>
272+
```
273+
274+
```svelte
275+
<!--- file: Child.svelte --->
276+
<script>
277+
let { label } = $props();
278+
</script>
279+
280+
<!-- This component doesn't expect a snippet, but the parent provided one -->
281+
<p>{label}</p>
282+
```
283+
247284
### store_invalid_shape
248285

249286
```

0 commit comments

Comments
 (0)