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
When using a value from a let:binding on the default slot inside a named slot, the bound value is sometimes undefined if the named slot is instantiated more than once in the child component.
I'm actually not sure if this is even valid to do. My intuition is that using a let binding from the default slot inside a named slot is sort of a scope violation and so the compiler should throw an error (or at least a warning to avoid breaking behavior).
If Svelte intentionally allows this, then the bug is just that showA is undefined in the first instantiation of the named slot.
Svelte REPL, 3.47.0. Also reproduced on 3.46.6 and this has presumably been around for a while.
Severity
annoyance
The text was updated successfully, but these errors were encountered:
dimfeld
changed the title
Buggy behavior when using a let binding from the default slot inside a named slot.
Undefined values when using a let binding from the default slot inside a named slot.
Apr 29, 2022
I'm actually not sure if this is even valid to do. My intuition is that using a let binding from the default slot inside a named slot is sort of a scope violation and so the compiler should throw an error (or at least a warning to avoid breaking behavior).
Describe the bug
When using a value from a let:binding on the default slot inside a named slot, the bound value is sometimes
undefined
if the named slot is instantiated more than once in the child component.I'm actually not sure if this is even valid to do. My intuition is that using a let binding from the default slot inside a named slot is sort of a scope violation and so the compiler should throw an error (or at least a warning to avoid breaking behavior).
If Svelte intentionally allows this, then the bug is just that
showA
isundefined
in the first instantiation of the named slot.Also related, the second half of this comment
Reproduction
https://svelte.dev/repl/a9bb52762959444da8da018ab04f6c7b?version=3.47.0
Logs
No response
System Info
Svelte REPL, 3.47.0. Also reproduced on 3.46.6 and this has presumably been around for a while.
Severity
annoyance
The text was updated successfully, but these errors were encountered: