-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[AGAIN] Incorrect error message "... received an unexpected slot "default". #6325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@YamiOdymel it would be great if you could provide a repl (https://svelte.dev/repl) / github repo that could replicate this issue? |
I think someone has replied with a command to reproduce the issue
|
@tanhauhau just a new svelte-kit project! |
@YamiOdymel @frederikhors yup. @YamiOdymel just want to confirm, whether the one you are reporting is the same root cause of the issue from svelte kit |
@tanhauhau shared some notes with me. Putting them here for reference for kit issue, it's because of code like this:
the Route component receives a default slot of
even if because of how slot is implemented right now, we pass the whole so, if we have a lot of 2 approaches:
|
Hey @benmccann! Thank you for the explanation. Wouldn't the following resolve the issue in kit? <svelte:component this={components[0]} {...(props_0 || {})}>
{#if components[1]}
{#if components[2]}
<svelte:component this={components[1]} {...(props_1 || {})}>
<svelte:component this={components[2]} {...(props_2 || {})}/>
</svelte:component>
{:else}
<svelte:component this={components[1]} {...(props_1 || {})} />
{/if}
{/if}
</svelte:component> If so, then sveltejs/kit#981 can be resolved on its own. |
@ebeloded That's causes |
@benmccann Approach #2 (passing #if into slot) might also resolve $$slots with slot forwarding |
For the records, This can also happen if one uses pug for writing the html, and accidentally calls the component like this: |
No fix yet? This is an extremely sad state of affairs. |
Fixed in Svelte 5 - the warning no longer appears, and also not for its replacements, snippets and render tags. |
Describe the bug
received an unexpected slot "XXXXXX"
for all the slots which were used in the component.Logs
To Reproduce
Expected behavior
No warning message should appeared.
Stacktraces
If you have a stack trace to include, we recommend putting inside a
<details>
block for the sake of the thread's readability:Information about your Svelte project:
Your browser and the version: (e.x. Chrome 52.1, Firefox 48.0, IE 10): Chrome 90
Your operating system: (e.x. OS X 10, Ubuntu Linux 19.10, Windows XP, etc): Ubuntu 19.10
Svelte version (Please check you can reproduce the issue with the latest release!): ^3.38.1
Whether your project uses Webpack or Rollup: Rollup
Severity
It's not immediate just annoying warning messages.
Additional context
Re-open an new issue from Incorrect error message "... received an unexpected slot "default". #4546
The text was updated successfully, but these errors were encountered: