motion icon indicating copy to clipboard operation
motion copied to clipboard

`transitionEnd` should not be applied when new animations caused the animation to stop

Open chuganzy opened this issue 2 years ago • 8 comments

This PR aims to fix an issue where transitionEnd styles are applied after new animation starts and accidentally overrides the latest motion values.

When new animation starts while animating, MotionValue stops the ongoing animation and immediately starts the new one. However as transitionEnd waits for all animations to be resolved, some transitionEnd styles overrides new values.

It seems to be introduced in https://github.com/framer/motion/pull/2025. Before it lands, calling stop() never resolves animation Promises, which are used to apply the transitionEnd styles at the end, so there was no race condition..

Closes: https://github.com/chakra-ui/chakra-ui/issues/7775

chuganzy avatar Jul 29 '23 00:07 chuganzy

Can you add a test for this behaviour? It also looks like this would stop all of transitionEnd values being applied if even any one of the values is animating.

mattgperry avatar Aug 03 '23 10:08 mattgperry

@mattgperry Sure, added a test and fixed the logic to check if animations completed vs canceled here

chuganzy avatar Aug 05 '23 05:08 chuganzy

Any update on this PR? I believe I am experiencing the issue this PR would fix

jonahallibone avatar Aug 24 '23 17:08 jonahallibone

This fix would resolve https://github.com/framer/motion/issues/2317. Any update on merging this fix?

stefanweck avatar Oct 11 '23 19:10 stefanweck

Bumping this, any update Framer team?

jonahallibone avatar Dec 11 '23 18:12 jonahallibone

Hey @mattgperry what do you think needs to happen to get this PR merged? I assume at a minimum it needs to be brought up-to-date with master. Is there anything else?

AndreiRailean avatar Feb 05 '24 06:02 AndreiRailean

Would like to bump this as well. I came here from the earlier linked accordion chakra UI issue. What else needs to happen to get this merged? @mattgperry

TranslucentDragon avatar Mar 06 '24 23:03 TranslucentDragon

It seems like this isn't a problem in the newest versions of framer motion. I haven't noticed it in in the most recent couple versions. Can anyone else confirm?

jonahallibone avatar Apr 15 '24 18:04 jonahallibone

It looks it's resolved already on my end too! Closing this PR.

chuganzy avatar May 29 '24 09:05 chuganzy