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
This might be a wontfix (it's a niche problem, and it's very easily worked around) but I don't have time to fully investigate it right now, so just leaving myself some breadcrumbs:
That's because on the initial pass, the {{else}} part is rendered, which initialises the binding between Main and Bar (because x doesn't yet have a value). Then, Svelte encounters the <Baz bind:x> component, and creates a new binding.
Bindings are flushed, which means that x has a value, which means that Bar is torn down (which has the effect of setting its _state to {}). Then the Bar binding is triggered, and y is set to undefined in Main.
As a starting point, no observer should be created when triggering a binding on a torn down component. (Perhaps observing a torndown component should also have no effect, or even throw — possibly a separate question.)
Changing the order of things in the template in Main.html yields different results:
(bar and not foo because by the time <Foo bind:y/> is created, y has a value in the parent component, and the child won't override the parent. Removing the phantom observer would presumably fix that as well.)
The text was updated successfully, but these errors were encountered:
This might be a wontfix (it's a niche problem, and it's very easily worked around) but I don't have time to fully investigate it right now, so just leaving myself some breadcrumbs:
That looks like it should result in this...
...but in fact it ends up like this:
That's because on the initial pass, the
{{else}}
part is rendered, which initialises the binding betweenMain
andBar
(becausex
doesn't yet have a value). Then, Svelte encounters the<Baz bind:x>
component, and creates a new binding.Bindings are flushed, which means that
x
has a value, which means thatBar
is torn down (which has the effect of setting its_state
to{}
). Then theBar
binding is triggered, andy
is set toundefined
inMain
.As a starting point, no observer should be created when triggering a binding on a torn down component. (Perhaps observing a torndown component should also have no effect, or even throw — possibly a separate question.)
Changing the order of things in the template in
Main.html
yields different results:(
bar
and notfoo
because by the time<Foo bind:y/>
is created,y
has a value in the parent component, and the child won't override the parent. Removing the phantom observer would presumably fix that as well.)The text was updated successfully, but these errors were encountered: