Open zommerberg opened 6 months ago
The value of myObjectItem
in <ComponentBody>
is currently set to the prop fallback value of <ComponentChild>
because of the binding. Hence, the value passed from the page to <ComponentBody>
is overwritten by that binding.
@eltigerchino The fallback should not be used at all since the object is defined at all time. Its weird that it uses a fallback and sets it to null.
Also I've tried removing the LayoutManager and replacing it with and if statement and suddenly it worked as expected without setting the bind property to null.
In the following repo I've removed the layout manager and repalced it with an if statement:
REPO: https://github.com/zommerberg/sveltekit-bind-bug-without-layout BLITZ: https://stackblitz.com/~/github.com/zommerberg/sveltekit-bind-bug-without-layout
Here the funciton does not get executed (as it should) and it behaves without the bug but the bind: is still not present yet svelte handles it correctly.
Describe the bug
I found a rare bug with multiple conditions that sets a variable that always exists to null when the parent of the children doesn't specify a bind: on that variable when passed to a child.
Look at the repo (and the console), it has a list of nested children and depended variables that cause this to happen, if one of the conditions is missing the value does not get set to null even if the bind: is missing.
Reproduction
https://stackblitz.com/~/github.com/zommerberg/sveltekit-bind-bug
https://github.com/zommerberg/sveltekit-bind-bug
I've reproduced it as closely as possible to my real project.
Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
No response