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
There are two related bugs. During an outro in a parent component, if the child component has a variable invalidated which an #if block is dependant on, and the #if block contains an element with its own transition, then either:
if the transition is |local, the intro transition will unexpectedly start playing
if the transition is |global, the parents outro will very unexpectedly stall at the end, leaving all elements visible and unmounted
(REPLs below)
There are several issues that are ultimately due to this, and I've encountered both bugs myself, so I think it could be quite widespread: #8606#8351#5268#9186
It appears that the first bug occurs because when the transition is |local the generated fragment doesn't track current so that when the up()date function calls transition_in, it is unable to early exit the i()ntro. It does actually do that correctly when |global is used though, so it might just be a case of using that logic more generally.
I'm not yet sure why the second bug is occurring, but I assume the logic is highly related.
There must be a parent and child component (if the child is inlined into the parent, the bug does not occur)
The parent must have a conditional block which becomes falsy, containing both a transition: element, and the child component
While the parent component's outro is playing (or at the same time as it starts), a variable in the child component must become invalidated. This is typically done by having a shared store be updated with a non-primitive value (but could also be from some other mechanism, such as calling a function exported from the child component that invalidates a value within the component to a non-primitive value)
The child component must have a conditional block which is apparently dependent on the invalidated variable, and which contains a transition: element (note that the conditional block can even be 'fixed' to always be true, so the value of the variable doesn't matter, only that it has been invalidated)
The child component's element will now start playing its intro transition
We experience the exact same bug while using the |global modifier in the transition. Are there any updates on this issue or does a workaround exist? (of course expect removing all transitions 😉)
Describe the bug
There are two related bugs. During an outro in a parent component, if the child component has a variable invalidated which an
#if
block is dependant on, and the#if
block contains an element with its own transition, then either:|local
, the intro transition will unexpectedly start playing|global
, the parents outro will very unexpectedly stall at the end, leaving all elements visible and unmounted(REPLs below)
There are several issues that are ultimately due to this, and I've encountered both bugs myself, so I think it could be quite widespread: #8606 #8351 #5268 #9186
It appears that the first bug occurs because when the transition is
|local
the generated fragment doesn't trackcurrent
so that when the up()
date function calls transition_in, it is unable to early exit thei()
ntro. It does actually do that correctly when|global
is used though, so it might just be a case of using that logic more generally.I'm not yet sure why the second bug is occurring, but I assume the logic is highly related.
Reproduction
This is the minimal test case that demonstrates the first behaviour:
https://svelte.dev/repl/b558e1303d1f45848b4dffc765c806dc?version=4.2.0
App.svelte
Child.svelte
The requirements are as follows:
transition:
element, and the child componenttransition:
element (note that the conditional block can even be 'fixed' to always be true, so the value of the variable doesn't matter, only that it has been invalidated)The second bug can be demonstrated by just changing the Child transition to
|global
:https://svelte.dev/repl/74b66e56366c491baf37f4baa4a1c347?version=4.2.0
This has the following effect:
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: