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
fix: add snippet argument validation in dev (#15521)
* init
* fix
* make `Payload` a class
* doh
* lint
* tweak changeset
* fix
* only export things that should be available on $
* tweak message
* fix
---------
Co-authored-by: Rich Harris <[email protected]>
Copy file name to clipboardExpand all lines: documentation/docs/98-reference/.generated/shared-errors.md
+6
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,12 @@ This error would be thrown in a setup like this:
30
30
31
31
Here, `List.svelte` is using `{@render children(item)` which means it expects `Parent.svelte` to use snippets. Instead, `Parent.svelte` uses the deprecated `let:` directive. This combination of APIs is incompatible, hence the error.
32
32
33
+
### invalid_snippet_arguments
34
+
35
+
```
36
+
A snippet function was passed invalid arguments. Snippets should only be instantiated via `{@render ...}`
Copy file name to clipboardExpand all lines: packages/svelte/messages/shared-errors/errors.md
+4
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,10 @@ This error would be thrown in a setup like this:
26
26
27
27
Here, `List.svelte` is using `{@render children(item)` which means it expects `Parent.svelte` to use snippets. Instead, `Parent.svelte` uses the deprecated `let:` directive. This combination of APIs is incompatible, hence the error.
28
28
29
+
## invalid_snippet_arguments
30
+
31
+
> A snippet function was passed invalid arguments. Snippets should only be instantiated via `{@render ...}`
32
+
29
33
## lifecycle_outside_component
30
34
31
35
> `%name%(...)` can only be used during component initialisation
* Only available on the server and when compiling with the `server` option.
102
62
* Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app.
@@ -106,14 +66,7 @@ function props_id_generator(prefix) {
Copy file name to clipboardExpand all lines: packages/svelte/src/internal/shared/errors.js
+15
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,21 @@ export function invalid_default_snippet() {
17
17
}
18
18
}
19
19
20
+
/**
21
+
* A snippet function was passed invalid arguments. Snippets should only be instantiated via `{@render ...}`
22
+
* @returns {never}
23
+
*/
24
+
exportfunctioninvalid_snippet_arguments(){
25
+
if(DEV){
26
+
consterror=newError(`invalid_snippet_arguments\nA snippet function was passed invalid arguments. Snippets should only be instantiated via \`{@render ...}\`\nhttps://svelte.dev/e/invalid_snippet_arguments`);
0 commit comments