fritz2 icon indicating copy to clipboard operation
fritz2 copied to clipboard

Timing problem with leave-animations

Open jwstegemann opened this issue 2 years ago • 3 comments

Leave animations can cause problems when the next patch(es) for a mount-point are applied before the animation is completed. This is because the patches work on indices of child-elements. When the dom-elements of animated tags are still there when the next patch is applied the indices calculated by the diff are not correct. The effect is, that some dom-nodes corresponding to removed elements are never deleted.

Possible solution:

Tag elements with a running leave-animation (for example by data-leaving) and do not count them in anymore, when patches are applied.

jwstegemann avatar Nov 03 '22 10:11 jwstegemann

Just a thought: Wouldn't it be better to wait for running animations to finish on the mount-point before we request a new value from the flow. This way we might to save a not necessary run of the Myer-diff. Or would this block other things? What do you think, @jamowei and @chausknecht ?

jwstegemann avatar Jan 19 '23 09:01 jwstegemann

It is quite reasonable, that this issue is allready fixed by PR #795 - we should investigate and then close this one.

Lysander avatar Sep 14 '23 15:09 Lysander

This is still a problem - this can be easily verfied with animations in toasts. Just enable the following uncommented animation code:

// headless-demo: toast.kt, L 108
        /*transition(
            enter = "transition-all duration-200 ease-in-out",
            enterStart = "opacity-0",
            enterEnd = "opacity-100",
            leave = "transition-all duration-200 ease-in-out",
            leaveStart = "opacity-100",
            leaveEnd = "opacity-0"
        )*/

Lysander avatar Jan 02 '24 08:01 Lysander