-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
passing props to unnamed slot when there are more than 1 slots passes the variable to the wrong slot #7084
Comments
https://svelte.dev/repl/46a62731088a48b6844793d4a8230cea?version=3.44.3 I think you need to explicitly have a "slot" attribute, because you need a top level element that receives the prop (you could have any number of Docs:
https://svelte.dev/docs#template-syntax-slot-slot-key-value But I think the compiler shouldn't compile
nvm, the docs say "Named slots can also expose values". You are exposing a value from the default slot and all slots receive it (#6049). If you have a value on a named slot, only the named slot receives it. So everything looks correct to me, with the exception that |
FYI, |
Sorry, I didn't see your reply until now,
I was mixing the use of a named slot with a default slot, which doesn't require a slot prop. Actually, looking at the last of your examples above it looks like you did the same thing just with a fragment instead of a div and it works... that seems like an inconsistency, it should also work with a div using a slot without the If this works: then you would expect it to work if you use a furthermore, if I'm passing a value to the default slot, I don't expect it to be passed to named slots also, is that by design? I was expecting
but in the case of using a
and in the case of using a div you get
|
I think your use of Example: |
oh ok, so, should it not work with the svelte:fragment as well? |
When both slots are named, each value mentioned against that slot is available inside the corresponding slot, REPL |
Fixed by #6049 |
Describe the bug
when having a named slot and an unnamed slot, passing a variable to the unnamed slot provides it to the first slot and not necessarily the unnamed one
Reproduction
https://svelte.dev/repl/cb94e73b99dc4847b739e370e9eddbb2?version=3.44.3
Logs
No response
System Info
was able to reproduce in repl
Severity
annoyance
The text was updated successfully, but these errors were encountered: