fix: properly validate snippet/slot interop#12421
Conversation
The previous validation for checking if slots with let directives were rendered with `{@render children(...)}` had false positives
- threw an error even if the other side didn't make use of the arguments, i.e. wasn't actually using a let directive
- didn't check that the rendered snippet actually was the children property
This fixes the validation by only applying it to children render tags, and by adding the slot to `$$slots.default` instead of `$$props.children` in more cases (when it's using `<svelte:fragment>` or `let:` directives, which both mean you're using old slot syntax)
Fixes #12414
🦋 Changeset detectedLatest commit: 01683b4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
I have been having this problem that I think is related to {@render ...} The error: "Uncaught (in promise) DOMException: Failed to execute 'appendChild' on 'Node': This node type does not support this method." This just happens when the project is builded, not in dev |
Probably related to #12422 |
The previous validation for checking if slots with let directives were rendered with `{@render children(...)}` had false positives
- threw an error even if the other side didn't make use of the arguments, i.e. wasn't actually using a let directive
- didn't check that the rendered snippet actually was the children property
This fixes the validation by only applying it to children render tags, and by adding the slot to `$$slots.default` instead of `$$props.children` in more cases (when it's using `<svelte:fragment>` or `let:` directives, which both mean you're using old slot syntax)
Fixes #12414
The previous validation for checking if slots with let directives were rendered with
{@render children(...)}had false positivesThis fixes the validation by only applying it to children render tags, and by adding the slot to
$$slots.defaultinstead of$$props.childrenin more cases (when it's using<svelte:fragment>orlet:directives, which both mean you're using old slot syntax)Fixes #12414
Before submitting the PR, please make sure you do the following
feat:,fix:,chore:, ordocs:.Tests and linting
pnpm testand lint the project withpnpm lint