Open webJose opened 6 days ago
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.
I logged the other slot variables coming from the base component's slot:
I guess it is no surprise, but they are all the same "proxy" object. To obtain the slot variable's correct value, the .fn
property must be evaluated.
So, after the investigation, the menu toolbar component can go back to working state by adding .fn()
to every slot variable being used:
on:click={(ev) => {
if (hasNodes.fn()) {
(setCurrentNode.fn())(node.fn());
}
}}
Can you provide a minimal reproduction in the repl?
Hello. I've tried to reproduce in the REPL but so far I've been unable to. I'll try with Sveltekit.
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