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
My scenario: A main component includes a slotted child component. The child component has a slot which passes a prop back to the parent. The main component is tracking enough variables to make dirty be an array. When the slot prop changes, an error occurs.
When the child component's slot prop changes, an error is thrown as the update is communicated back to the parent. It appears that the call to get_slot_changes in the child component's update function is returning undefined.
Expected behavior
No error is thrown.
Information about your Svelte project:
Svelte 3.20.1 (see REPL)
Severity
Important but not blocking. Svelte 3.15 before the dirty bitmask change works, so I've been able to revert to that, but I am using some features that were added in later versions, such as referencing a slot variable in an attribute of the slot (e.g. <tr slot="row" let:row class:finished={row.finished}>...). I have worked around the lack of 3.16+ features for now.
The text was updated successfully, but these errors were encountered:
It appears that this is specifically related to the slot in the parent NOT using the slot prop. In the REPL, if I add let:open in the parent then it works, even if I never actually use open.
In the breaking case, I see that the definition passed to get_slot_changes contains a single entry, the function to create the slot. When I add let:open, I see that definition has two more entries, and so the check for definition[2] && fn returns true, leading to the working code path. Seems like the obvious fix is to always generate the extra two entries in definition even if they would do nothing, but I'm not familiar enough with the Svelte internals to say for sure.
I've confirmed that this workaround also fixes the problem in my actual codebase, so I'm no longer blocked.
My scenario: A main component includes a slotted child component. The child component has a slot which passes a prop back to the parent. The main component is tracking enough variables to make dirty be an array. When the slot prop changes, an error occurs.
To Reproduce
Open this REPL, open the console, and click the Toggle button. See that an error occurs:
Cannot read property '0' of undefined
.https://svelte.dev/repl/8f6205fdd9d04a5aa250c1c67f6efbce?version=3.20.1
When the child component's slot prop changes, an error is thrown as the update is communicated back to the parent. It appears that the call to
get_slot_changes
in the child component's update function is returningundefined
.Expected behavior
No error is thrown.
Information about your Svelte project:
Svelte 3.20.1 (see REPL)
Severity
Important but not blocking. Svelte 3.15 before the dirty bitmask change works, so I've been able to revert to that, but I am using some features that were added in later versions, such as referencing a slot variable in an attribute of the slot (e.g.
<tr slot="row" let:row class:finished={row.finished}>...
). I have worked around the lack of 3.16+ features for now.The text was updated successfully, but these errors were encountered: