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
I the library I'm working on, I have a not-so-simple arrangement of components that together form a menu toolbar. The base component provides a named slot with a variable named setCurrentNode that, when run (because it is a function), performs the menu navigation. The function really teakes two parameters, but the second parameter is pre-filled by the base component, so the slot looks like this:
This works as expected in Svelte v4. In Svelte v5-next.166, however, the function is no longer a function. The consumer component, when doing let:setCurrentNode does not receive a function in the setCurrentNode variable and instead receives an object:
The word "object" in the screenshot is the result of typeof setCurrentNode.
If you notice, there's an fn property in the object that looks like a function. I tested by modifying the code from setCurrentNode(node) to setCurrentNode.fn(node) and this makes the error go away (I did not mention, but the error I get is setCurrentNode is not a function). However, while the error is gone, the logic of setCurrentNode does not seem to be happening.
Reproduction
This is private IP, and I tried to reproduce this, but it seems to be a non-trivial task to do so. If really important, I'll try again, but maybe you Svelte members recognize this object I'm showing in the screenshot and perhaps that's enough to locate the problem? Do let me know, as I'm very willing to help with whatever I can.
I have discovered that setCurrentNode.fn() returns the slot variable contents (what is expected to get directly in setCurrentNode). So I suppose some internal structure is being leaked here, for some reason unknown to me.
Describe the bug
I the library I'm working on, I have a not-so-simple arrangement of components that together form a menu toolbar. The base component provides a named slot with a variable named
setCurrentNode
that, when run (because it is a function), performs the menu navigation. The function really teakes two parameters, but the second parameter is pre-filled by the base component, so the slot looks like this:This works as expected in Svelte v4. In Svelte v5-next.166, however, the function is no longer a function. The consumer component, when doing
let:setCurrentNode
does not receive a function in thesetCurrentNode
variable and instead receives an object:The word "object" in the screenshot is the result of
typeof setCurrentNode
.If you notice, there's an
fn
property in the object that looks like a function. I tested by modifying the code fromsetCurrentNode(node)
tosetCurrentNode.fn(node)
and this makes the error go away (I did not mention, but the error I get issetCurrentNode is not a function
). However, while the error is gone, the logic ofsetCurrentNode
does not seem to be happening.Reproduction
This is private IP, and I tried to reproduce this, but it seems to be a non-trivial task to do so. If really important, I'll try again, but maybe you Svelte members recognize this object I'm showing in the screenshot and perhaps that's enough to locate the problem? Do let me know, as I'm very willing to help with whatever I can.
Logs
No response
System Info
Severity
blocking all usage of svelte
The text was updated successfully, but these errors were encountered: